Skip to content

Commit 37bc37f

Browse files
authored
Cleanup do_run_in_out_file_test in tests/test_core.py (emscripten-core#6324)
1 parent 3e9072f commit 37bc37f

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

tests/test_core.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,26 +96,21 @@ def maybe_closure(self):
9696
def do_run_in_out_file_test(self, *path, **kwargs):
9797
test_path = path_from_root(*path)
9898

99-
def find_extension(*ext_list):
99+
def find_files(*ext_list):
100100
ret = None
101101
count = 0
102102
for ext in ext_list:
103103
if os.path.isfile(test_path + ext):
104-
ret = ext
104+
ret = test_path + ext
105105
count += 1
106-
if count == 0:
107-
assert False, ("No file found at {} with extension {}"
108-
.format(test_path, ext_list))
109-
if count > 1:
110-
assert False, ("Test file {} found with multiple valid extensions {}"
111-
.format(test_path, ext_list))
106+
assert count > 0, ("No file found at {} with extension {}"
107+
.format(test_path, ext_list))
108+
assert count <= 1, ("Test file {} found with multiple valid extensions {}"
109+
.format(test_path, ext_list))
112110
return ret
113111

114-
input_extensions = find_extension('.c', '.cpp', '.cc')
115-
output_extensions = find_extension('.out', '.txt')
116-
extensions = (input_extensions, output_extensions)
117-
118-
src, output = (test_path + ext for ext in extensions)
112+
src = find_files('.c', '.cpp', '.cc')
113+
output = find_files('.out', '.txt')
119114
self.do_run_from_file(src, output, **kwargs)
120115

121116
def test_hello_world(self):

0 commit comments

Comments
 (0)