Skip to content

Commit c78fddf

Browse files
authored
Make do_run tests functions consistent (#16909)
- `do_run` also sets `expected_output=None`, like `do_runf`. - `do_run`, `do_run_from_file`, and `do_run_in_out_file_test` now return the stdout+stderr output, like `do_runf`.
1 parent f87d4ab commit c78fddf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ def filtered_js_engines(self, js_engines=None):
11001100
banned = [b[0] for b in self.banned_js_engines if b]
11011101
return [engine for engine in js_engines if engine and engine[0] not in banned]
11021102

1103-
def do_run(self, src, expected_output, force_c=False, **kwargs):
1103+
def do_run(self, src, expected_output=None, force_c=False, **kwargs):
11041104
if 'no_build' in kwargs:
11051105
filename = src
11061106
else:
@@ -1109,21 +1109,21 @@ def do_run(self, src, expected_output, force_c=False, **kwargs):
11091109
else:
11101110
filename = 'src.cpp'
11111111
write_file(filename, src)
1112-
self._build_and_run(filename, expected_output, **kwargs)
1112+
return self._build_and_run(filename, expected_output, **kwargs)
11131113

11141114
def do_runf(self, filename, expected_output=None, **kwargs):
11151115
return self._build_and_run(filename, expected_output, **kwargs)
11161116

11171117
## Just like `do_run` but with filename of expected output
11181118
def do_run_from_file(self, filename, expected_output_filename, **kwargs):
1119-
self._build_and_run(filename, read_file(expected_output_filename), **kwargs)
1119+
return self._build_and_run(filename, read_file(expected_output_filename), **kwargs)
11201120

11211121
def do_run_in_out_file_test(self, *path, **kwargs):
11221122
srcfile = test_file(*path)
11231123
out_suffix = kwargs.pop('out_suffix', '')
11241124
outfile = shared.unsuffixed(srcfile) + out_suffix + '.out'
11251125
expected = read_file(outfile)
1126-
self._build_and_run(srcfile, expected, **kwargs)
1126+
return self._build_and_run(srcfile, expected, **kwargs)
11271127

11281128
## Does a complete test - builds, runs, checks output, etc.
11291129
def _build_and_run(self, filename, expected_output, args=[], output_nicerizer=None,

0 commit comments

Comments
 (0)