diff options
| author | Leitwolf | 2026-10-24 19:03:40 +0300 |
|---|---|---|
| committer | GitHub | 2026-10-24 19:03:40 +0300 |
| commit | 4f1c759cffcb14bd6511e1d7c5fbace682e24f2d (patch) | |
| tree | 415fe5d48a5b48650bba3747beaf245d727c4f61 /tests/TestScripts/testConfigureExperimentalRedirect.py | |
| parent | 83c6fc3ac13abe83fa39f7b5f8559ccaf4412233 (diff) | |
| parent | 622188f9c08e4af35941c146979883ed4882410e (diff) | |
| download | catch3-4f1c759cffcb14bd6511e1d7c5fbace682e24f2d.tar.gz | |
Merge pull request #15 from Progmasoft/feature/catch3-runner
Replace Catch2's runner with the Catch3 runner
Diffstat (limited to 'tests/TestScripts/testConfigureExperimentalRedirect.py')
| -rw-r--r-- | tests/TestScripts/testConfigureExperimentalRedirect.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/TestScripts/testConfigureExperimentalRedirect.py b/tests/TestScripts/testConfigureExperimentalRedirect.py index 09ff51e2..cf659e9e 100644 --- a/tests/TestScripts/testConfigureExperimentalRedirect.py +++ b/tests/TestScripts/testConfigureExperimentalRedirect.py @@ -9,6 +9,7 @@ from ConfigureTestsCommon import configure_and_build, run_and_return_output +import json import os import re import sys @@ -32,18 +33,17 @@ configure_and_build(catch2_source_path, build_dir_path, [("CATCH_CONFIG_EXPERIMENTAL_REDIRECT", "ON")]) -stdout, _ = run_and_return_output(os.path.join(build_dir_path, 'tests'), - 'SelfTest', - ['-r', 'xml', '"has printf"']) - - -# The print from printf must be within the XML's reporter stdout tag. -required_output = '''\ - <StdOut> -loose text artifact - </StdOut> -''' -if not required_output in stdout: - print("Could not find '{}' in the stdout".format(required_output)) - print('stdout: "{}"'.format(stdout)) +report_path = os.path.join(build_dir_path, 'has-printf.json') +run_and_return_output(os.path.join(build_dir_path, 'tests'), + 'SelfTest', + ['--no-history', '--json=' + report_path, 'has printf']) + +# The text printf writes must be captured as the test's standard output. +with open(report_path, encoding='utf-8') as report_file: + report = json.load(report_file) +outputs = [attempt.get('standardOutput', '') + for test in report['tests'] + for attempt in test['attempts']] +if outputs != ['loose text artifact\n']: + print('Unexpected captured output: {}'.format(outputs)) exit(2) |