This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/re/regexp.t: Better formatting for test failures
authorDan Collins <dcollinsn@gmail.com>
Sat, 18 Jun 2016 20:52:26 +0000 (16:52 -0400)
committerTony Cook <tony@develop-help.com>
Mon, 11 Jul 2016 00:02:07 +0000 (10:02 +1000)
On test failure, most of our tests output a description of the test,
followed by the actual result ("got") and the desired result
("expected"). This brings the tests in t/re/re_tests in line by
adding "expected" to the output, and changing the order slightly,
to more naturally describe the test, the output, and the expectation.

t/re/regexp.t

index 8e98e55..38a24d5 100644 (file)
@@ -442,7 +442,8 @@ EOFCODE
                else { # better diagnostics
                    my $s = Data::Dumper->new([$subject],['subject'])->Useqq(1)->Dump;
                    my $g = Data::Dumper->new([$got],['got'])->Useqq(1)->Dump;
-                   print "not ok $testname$todo ($study) $input => '$got', match=$match\n", _comment("$s\n$g\n$code\n");
+                   my $e = Data::Dumper->new([$expect],['expected'])->Useqq(1)->Dump;
+                   print "not ok $testname$todo ($study) $input => '$got', match=$match\n", _comment("$s\n$code\n$g\n$e\n");
                }
                next TEST;
            }