Skip to content

Commit b57c7e0

Browse files
committed
Better output validation for catching bug #807
1 parent 1be9a7d commit b57c7e0

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

test/rakefile_helper.rb

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,33 @@ def run_tests(test_files)
293293
# Link the test executable
294294
link_it(test_base, obj_list)
295295

296-
# Execute unit test and generate results file
296+
# Execute unit test
297297
output = runtest(test_base)
298+
299+
# Verify outputs seem to have happened
300+
failures = 0
301+
output = output.each_line.map do |line|
302+
if line =~ /Element.*Expected.*Was/ && !(line =~ /Element \d+ Expected \S+ Was \S+/)
303+
failures += 1
304+
line + " [[[[ OUTPUT FAILED TO PRINT CORRECTLY ]]]]"
305+
else
306+
line
307+
end
308+
end.join
309+
310+
# Update the final test summary
311+
if failures > 0
312+
output.sub!(/^(\d+) Tests (\d+) Failures (\d+) Ignored/) do
313+
tests = $1
314+
failures = $2.to_i + failures
315+
ignored = $3
316+
"#{tests} Tests #{failures} Failures #{ignored} Ignored"
317+
end
318+
output.sub!(/OK$/,"FAILED")
319+
report output
320+
end
321+
322+
# Generate results file
298323
save_test_results(test_base, output)
299324
end
300325
end

0 commit comments

Comments
 (0)