diff options
Diffstat (limited to 'tests/test_driver.pl')
-rw-r--r-- | tests/test_driver.pl | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/test_driver.pl b/tests/test_driver.pl index bea9816..dd30320 100644 --- a/tests/test_driver.pl +++ b/tests/test_driver.pl @@ -661,15 +661,23 @@ sub compare_output $answer_matched = 1; } else { # See if it is a slash or CRLF problem - local ($answer_mod) = $answer; + local ($answer_mod, $slurp_mod) = ($answer, $slurp); $answer_mod =~ tr,\\,/,; $answer_mod =~ s,\r\n,\n,gs; - $slurp =~ tr,\\,/,; - $slurp =~ s,\r\n,\n,gs; + $slurp_mod =~ tr,\\,/,; + $slurp_mod =~ s,\r\n,\n,gs; - $answer_matched = ($slurp eq $answer_mod); + $answer_matched = ($slurp_mod eq $answer_mod); + + # If it still doesn't match, see if the answer might be a regex. + if (!$answer_matched && $answer =~ m,^/(.+)/$,) { + $answer_matched = ($slurp =~ /$1/); + if (!$answer_matched && $answer_mod =~ m,^/(.+)/$,) { + $answer_matched = ($slurp_mod =~ /$1/); + } + } } if ($answer_matched && $test_passed) |