Test Adapters: Always use the last output for score runs

* This prevents learners from cheating by printing the required status line themselves
This commit is contained in:
Sebastian Serth
2021-11-02 15:52:49 +01:00
parent d7e515f1c6
commit 3d3478d859
8 changed files with 33 additions and 33 deletions

View File

@ -10,13 +10,13 @@ class Junit5Adapter < TestingFrameworkAdapter
end
def parse_output(output)
count = COUNT_REGEXP.match(output[:stdout]).try(:captures).try(:first).try(:to_i) || 0
failed = FAILURES_REGEXP.match(output[:stdout]).try(:captures).try(:first).try(:to_i) || 0
count = output[:stdout].scan(COUNT_REGEXP).try(:last).try(:first).try(:to_i) || 0
failed = output[:stdout].scan(FAILURES_REGEXP).try(:last).try(:first).try(:to_i) || 0
if failed.zero?
{count: count, passed: count}
else
error_matches = ASSERTION_ERROR_REGEXP.match(output[:stdout]).try(:captures) || []
{count: count, failed: failed, error_messages: error_matches}
error_matches = output[:stdout].scan(ASSERTION_ERROR_REGEXP) || []
{count: count, failed: failed, error_messages: error_matches.flatten.reject(&:blank?)}
end
end
end