@@ -96,26 +96,21 @@ def maybe_closure(self):
96
96
def do_run_in_out_file_test (self , * path , ** kwargs ):
97
97
test_path = path_from_root (* path )
98
98
99
- def find_extension (* ext_list ):
99
+ def find_files (* ext_list ):
100
100
ret = None
101
101
count = 0
102
102
for ext in ext_list :
103
103
if os .path .isfile (test_path + ext ):
104
- ret = ext
104
+ ret = test_path + ext
105
105
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 ))
112
110
return ret
113
111
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' )
119
114
self .do_run_from_file (src , output , ** kwargs )
120
115
121
116
def test_hello_world (self ):
0 commit comments