Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Report correct line numbers for failing tests
The hard coded level for callframe we had before did only match in some cases.
Now we're looking outwards until we leave Test.pm

Additionally we can grab the call frame from within conditional,
since the bug which prevented that seems to be gone (cmp. commit 4111fa4).
  • Loading branch information
usev6 committed Apr 2, 2015
1 parent 1457816 commit 3a8ecbc
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 3a8ecbc

Please sign in to comment.