Skip to content

Commit

Permalink
report expected and actual results after "is" test failure
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Lenz <moritz@faui2k3.org>
  • Loading branch information
kyleha authored and moritz committed Jul 25, 2009
1 parent dd5767c commit 240b984
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Test.pm
Expand Up @@ -63,6 +63,14 @@ multi sub nok(Object $cond) is export(:DEFAULT) { nok($cond, ''); }
multi sub is(Object $got, Object $expected, $desc) is export(:DEFAULT) {
my $test = $got eq $expected;
proclaim(?$test, $desc);
if !$test {
my $got_perl = try { $got.perl };
my $expected_perl = try { $expected.perl };
if $got_perl.defined && $expected_perl.defined {
diag " got: $got_perl";
diag "expected: $expected_perl";
}
}
}

multi sub is(Object $got, Object $expected) is export(:DEFAULT) { is($got, $expected, ''); }
Expand Down

0 comments on commit 240b984

Please sign in to comment.