Created
April 18, 2009 13:00
-
-
Save anonymous/97592 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Test.pm b/Test.pm | |
index 0f90a16..4dd5220 100644 | |
--- a/Test.pm | |
+++ b/Test.pm | |
@@ -60,7 +60,7 @@ 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); | |
+ proclaim(?$test, $desc, $got, $expected); | |
} | |
multi sub is(Object $got, Object $expected) is export(:DEFAULT) { is($got, $expected, ''); } | |
@@ -204,7 +204,7 @@ sub eval_exception($code) { | |
$eval_exception // $!; | |
} | |
-sub proclaim($cond, $desc) { | |
+multi sub proclaim($cond, $desc) { | |
$testing_started = 1; | |
$num_of_tests_run = $num_of_tests_run + 1; | |
@@ -224,9 +224,19 @@ sub proclaim($cond, $desc) { | |
} | |
# must clear this between tests | |
$todo_reason = ''; | |
+ | |
return $cond; | |
} | |
- | |
+multi sub proclaim($cond, $desc, $got, $expected) { | |
+ proclaim($cond, $desc); | |
+ | |
+ if (!$cond and $got and $expected ) { | |
+ # print out debugoutput | |
+ diag("got: " ~ $got.perl ~ ", expected: " ~ $expected.perl); | |
+ } | |
+ return $cond; | |
+ | |
+} | |
END { | |
# until END blocks can access compile-time symbol tables of outer scopes, | |
# we need these declarations |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment