summaryrefslogtreecommitdiff
path: root/t/04codelocation.t
diff options
context:
space:
mode:
Diffstat (limited to 't/04codelocation.t')
-rw-r--r--t/04codelocation.t26
1 files changed, 26 insertions, 0 deletions
diff --git a/t/04codelocation.t b/t/04codelocation.t
new file mode 100644
index 0000000..917fed6
--- /dev/null
+++ b/t/04codelocation.t
@@ -0,0 +1,26 @@
+#!perl
+
+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' );
+}