diff options
Diffstat (limited to 't/04codelocation-pureperl.t')
-rw-r--r-- | t/04codelocation-pureperl.t | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/t/04codelocation-pureperl.t b/t/04codelocation-pureperl.t new file mode 100644 index 0000000..04f6280 --- /dev/null +++ b/t/04codelocation-pureperl.t @@ -0,0 +1,26 @@ +#!perl +BEGIN { $ENV{PERL_SUB_IDENTIFY_PP} = 1 } +use Test::More tests => 6; +use Sub::Identify ':all'; + +sub newton { + print; + print; + print; + print; + print; + print; + print; +} +*hooke = *newton; +for ( \&newton, \&hooke ) { + my ($file, $line) = get_code_location($_); + is( $file, $0, 'file' ); + is( $line, 7, 'line' ); +} +{ + sub pauli; + my ($file, $line) = get_code_location(\&pauli); + ok( !defined $file, 'no definition, no file' ); + ok( !defined $line, 'no definition, no line' ); +} |