From a2cfab583c8739356fd7e6c0f822e8f247e61b87 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 10 Jul 2023 02:42:53 +0200 Subject: test: test CI run output containing \0 --- test/py/lib/test_repo.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'test/py/lib') diff --git a/test/py/lib/test_repo.py b/test/py/lib/test_repo.py index 3234de5..b882d57 100644 --- a/test/py/lib/test_repo.py +++ b/test/py/lib/test_repo.py @@ -167,3 +167,29 @@ class TestRepoOutputLong(TestRepoOutput): def run_output_matches(self, output): return output.decode() == self.output + + +OUTPUT_SCRIPT_NULL = R'''#!/usr/bin/env python3 + +output = {output} + +import sys +sys.stdout.buffer.write(output) +''' + + +class TestRepoOutputNull(TestRepoOutput): + __test__ = False + + OUTPUT = b'123\x00456' + + def __init__(self, *args, **kwargs): + self.output = TestRepoOutputNull.OUTPUT + super().__init__(*args, **kwargs) + + def _format_output_script(self): + assert len(self.output) == 7 + return OUTPUT_SCRIPT_NULL.format(output=repr(self.output)) + + def run_output_matches(self, output): + return output == self.output -- cgit v1.2.3