Skip to content

Commit

Permalink
Implement source position display on test failure
Browse files Browse the repository at this point in the history
  • Loading branch information
sorear committed Jul 28, 2010
1 parent 0c323ff commit 74d317f
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Test.pm6
@@ -1,9 +1,20 @@
my module Test;
module Test; # XXX our due to the STD pad bug

constant $?TRANSPARENT = 1;

sub blame() {
my $frame = caller;
while $frame.hints('$?TRANSPARENT') {
$frame = $frame.caller;
}
$frame.file ~ (" line " ~ $frame.line);
}

my $testnum = 1;
sub ok($bool, $tag) is export {
my $not = (if $bool { "" } else { "not " });
say ($not ~ ("ok " ~ ($testnum++ ~ (" - " ~ $tag))));
if !$bool { say ("# " ~ blame()); }
}

sub plan($num) is export {
Expand Down

0 comments on commit 74d317f

Please sign in to comment.