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

@ -9,11 +9,11 @@ class RScriptAdapter < TestingFrameworkAdapter
end
def parse_output(output)
captures = REGEXP.match(output[:stdout]).captures.map(&:to_i)
captures = output[:stdout].scan(REGEXP).try(:last).map(&:to_i)
count = captures.first
passed = captures.second
failed = count - passed
assertion_error_matches = output[:stdout].scan(ASSERTION_ERROR_REGEXP).flatten || []
{count: count, failed: failed, error_messages: assertion_error_matches}
assertion_error_matches = output[:stdout].scan(ASSERTION_ERROR_REGEXP) || []
{count: count, failed: failed, error_messages: assertion_error_matches.flatten.reject(&:blank?)}
end
end