]> git.vpit.fr Git - perl/modules/indirect.git/blobdiff - t/10-good.t
More tests with $_
[perl/modules/indirect.git] / t / 10-good.t
index b88d721779fd773545a194f9451235b45b573cf2..e503cecde5ae03fd7bcefd8c186a3fd0ddc44585 100644 (file)
@@ -1,29 +1,45 @@
 #!perl -T
 
+package Dongs;
+
+sub new;
+
+package main;
+
 use strict;
 use warnings;
 
-use Test::More tests => 36 * 2;
+use Test::More tests => 45 * 4;
 
-my ($obj, $pkg, $cb, $x);
+my ($obj, $pkg, $cb, $x, @a);
 sub meh;
 
 {
  local $/ = "####\n";
  while (<DATA>) {
   chomp;
+  local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) };
   {
    use indirect;
-   local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) };
    eval "die qq{ok\\n}; $_";
   }
-  is($@, "ok\n", $_);
+  is($@, "ok\n", "use indirect: $_");
   {
    no indirect;
-   local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) };
    eval "die qq{ok\n}; $_";
   }
-  is($@, "ok\n", $_);
+  is($@, "ok\n", "no indirect: $_");
+  s/Hlagh/Dongs/g;
+  {
+   use indirect;
+   eval "die qq{ok\\n}; $_";
+  }
+  is($@, "ok\n", "use indirect, defined: $_");
+  {
+   no indirect;
+   eval "die qq{ok\\n}; $_";
+  }
+  is($@, "ok\n", "no indirect, defined: $_");
  }
 }
 
@@ -113,9 +129,19 @@ $obj = new
       $x
     }(qw/bar baz/);
 ####
+meh;
+####
+meh $_;
+####
 meh $x;
 ####
-meh $x, 1 , 2;
+meh $x, 1, 2;
+####
+print;
+####
+print $_;
+####
+print $x;
 ####
 print STDOUT "bananananananana\n";
 ####
@@ -128,3 +154,11 @@ $obj = "apple ${\(new Hlagh)} pear"
 $obj = "apple @{[new Hlagh]} pear"
 ####
 s/dongs/new Hlagh/e;
+####
+exec $x $x, @a;
+####
+exec { $a[0] } @a;
+####
+system $x $x, @a;
+####
+system { $a[0] } @a;