]> git.vpit.fr Git - perl/modules/Sub-Op.git/blobdiff - t/10-base.t
Test storing the reference to a keyword
[perl/modules/Sub-Op.git] / t / 10-base.t
index b5ce7317d85c165fdbc37b0240fd4b8e8f6f439b..6e6b5d12eeb0f0877693bde8e734e81bca103666 100644 (file)
@@ -5,7 +5,7 @@ use warnings;
 
 use blib 't/Sub-Op-LexicalSub';
 
-use Test::More tests => (1 + 3) * 15 + (1 + 2 * 3) * 2 + 2 * 28;
+use Test::More tests => (1 + 3) * 16 + (1 + 2 * 3) * 2 + 2 * 29;
 
 our $called;
 
@@ -71,7 +71,7 @@ our $called;
 
   is $called, $calls, "@names: the hook was called the right number of times";
   if ($called < $calls) {
-   fail for $called + 1 .. $calls;
+   fail, fail for $called + 1 .. $calls;
   }
  }
 }
@@ -128,6 +128,16 @@ fetch 1, do { no strict 'refs'; *{__PACKAGE__.'::fetch'}{CODE} }, 2
 ----
 fetch # () # [ 1, undef, 2 ]
 ####
+my ($cb, $err);
+BEGIN {
+ $cb = do { no strict 'refs'; \&{__PACKAGE__.'::cvref'} };
+ eval { $cb->() };
+ $err = $@ =~ /^Undefined subroutine &main::cvref/ ? undef : $@;
+}
+cvref $err;
+----
+cvref # () # [ undef ]
+####
 our $scalr = 1;
 scalr $scalr;
 ----