Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #401 from usev6/fix_test.pm
Report correct line numbers for failing tests
  • Loading branch information
perlpilot committed Apr 2, 2015
2 parents 1457816 + 3a8ecbc commit b4576d7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/Test.pm
Expand Up @@ -461,9 +461,12 @@ sub proclaim($cond, $desc) {
~ "\n"
if $perl6_test_times;

my $caller = callframe(3); # due to a bug in MoarVM, this callframe has to occur outside of the
# unless block (see https://github.com/MoarVM/MoarVM/issues/120)
unless $cond {
my $caller;
my $level = 3; # sub proclaim is not called directly, so 3 is minimum level
repeat until $caller.file ne $?FILE {
$caller = callframe($level++);
}
if $desc ne '' {
diag "\nFailed test '$desc'\nat {$caller.file} line {$caller.line}";
} else {
Expand Down

0 comments on commit b4576d7

Please sign in to comment.