diff options
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/game/hub.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/backend/game/hub.go b/backend/game/hub.go index 436acf5..364e590 100644 --- a/backend/game/hub.go +++ b/backend/game/hub.go @@ -141,8 +141,13 @@ func (hub *Hub) processTaskResultRunTestcase( return nil } +func normalizeTestcaseResultOutput(s string) string { + re := regexp.MustCompile(`\r\n|\r`) + return re.ReplaceAllString(strings.TrimSpace(s), "\n") +} + func isTestcaseResultCorrect(expectedStdout, actualStdout string) bool { - expectedStdout = strings.TrimSpace(expectedStdout) - actualStdout = strings.TrimSpace(actualStdout) + expectedStdout = normalizeTestcaseResultOutput(expectedStdout) + actualStdout = normalizeTestcaseResultOutput(actualStdout) return actualStdout == expectedStdout } |
