Subject: | Wrongly reported line numbers when if a new line is before keyword "func". |
When I use:
my $code_ref =
func () { };
Then following lines in file are "shifted", i.e. they reports wrong line number.
See attached test file (*.t) and test output (*.txt).
Subject: | test-Method-Signatures-wrong-line-numbers.t |
use Test::Spec;
use Method::Signatures;
print STDERR "perl version: $^V\n";
print STDERR "package version: $Method::Signatures::VERSION\n";
describe 'test Method::Signatures bug' => sub {
it "correctly reports line numbers after assign anonymous function" => sub {
my $before_line = __LINE__;
my $get_line =
func () { __LINE__ };
my $after_line = __LINE__;
is( $get_line->(), $before_line + 2 );
is( $after_line, $before_line + 3 );
is( "this is line ".__LINE__, "this is line 14");
};
};
runtests();
Subject: | test-Method-Signatures-wrong-line-numbers.txt |
Test Summary Report
-------------------
perllib/Method/Signatures/t/Netsafe.t (Wstat: 768 Tests: 3 Failed: 3)
Failed tests: 1-3
Non-zero exit status: 3
Files=1, Tests=3, 0 wallclock secs ( 0.04 usr 0.00 sys + 0.16 cusr 0.00 csys = 0.20 CPU)
Result: FAIL
perl version: v5.20.3
package version: 20160315
# Failed test 'test Method::Signatures bug correctly reports line numbers after assign anonymous function'
# at perllib/Method/Signatures/t/Netsafe.t line 14.
# got: '11'
# expected: '12'
# Failed test 'test Method::Signatures bug correctly reports line numbers after assign anonymous function'
# at perllib/Method/Signatures/t/Netsafe.t line 15.
# got: '12'
# expected: '13'
# Failed test 'test Method::Signatures bug correctly reports line numbers after assign anonymous function'
# at perllib/Method/Signatures/t/Netsafe.t line 16.
# got: 'this is line 16'
# expected: 'this is line 14'
# Looks like you failed 3 tests of 3.