X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F10-good.t;h=91b1ac04d0360b56a2a156111e6b8cd660aa1f4b;hb=b7b7a0878db622b9fabce664554b51d965eb7bc7;hp=e503cecde5ae03fd7bcefd8c186a3fd0ddc44585;hpb=f09d654a5606b2176a224ea7f45cfdef3dc761e9;p=perl%2Fmodules%2Findirect.git diff --git a/t/10-good.t b/t/10-good.t index e503cec..91b1ac0 100644 --- a/t/10-good.t +++ b/t/10-good.t @@ -9,41 +9,48 @@ package main; use strict; use warnings; -use Test::More tests => 45 * 4; +use Test::More tests => 52 * 4; my ($obj, $pkg, $cb, $x, @a); +our $y; sub meh; { - local $/ = "####\n"; + local $/ = "####"; while () { chomp; - local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) }; - { - use indirect; - eval "die qq{ok\\n}; $_"; - } - is($@, "ok\n", "use indirect: $_"); - { - no indirect; - eval "die qq{ok\n}; $_"; - } - is($@, "ok\n", "no indirect: $_"); - s/Hlagh/Dongs/g; - { - use indirect; - eval "die qq{ok\\n}; $_"; - } - is($@, "ok\n", "use indirect, defined: $_"); + s/\s*$//; + s/(.*?)$//m; + my ($skip, $prefix) = split /#+/, $1; + $skip = 0 unless defined $skip; + $prefix = '' unless defined $prefix; + s/\s*//; + +SKIP: { - no indirect; - eval "die qq{ok\\n}; $_"; + skip "$_: $skip" => 4 if eval $skip; + + local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) }; + + eval "die qq{ok\\n}; $prefix; use indirect; $_"; + is($@, "ok\n", "use indirect: $_"); + + eval "die qq{ok\n}; $prefix; no indirect; $_"; + is($@, "ok\n", "no indirect: $_"); + + s/Hlagh/Dongs/g; + + eval "die qq{ok\\n}; $prefix; use indirect; $_"; + is($@, "ok\n", "use indirect, defined: $_"); + + eval "die qq{ok\\n}; $prefix; no indirect; $_"; + is($@, "ok\n", "no indirect, defined: $_"); } - is($@, "ok\n", "no indirect, defined: $_"); } } __DATA__ + $obj = Hlagh->new; #### $obj = Hlagh->new(); @@ -137,24 +144,38 @@ meh $x; #### meh $x, 1, 2; #### +meh $y; +#### +meh $y, 1, 2; +#### $] < 5.010 # use feature 'state'; state $z +meh $z; +#### $] < 5.010 # use feature 'state'; state $z +meh $z, 1, 2; +#### print; #### print $_; #### print $x; #### -print STDOUT "bananananananana\n"; -#### print $x "oh hai\n"; #### -$x->foo($pkg->$cb) +print $y; +#### +print $y "dongs\n"; +#### $] < 5.010 # use feature 'state'; state $z +print $z; +#### $] < 5.010 # use feature 'state'; state $z +print $z "hlagh\n"; +#### +print STDOUT "bananananananana\n"; #### +$x->foo($pkg->$cb) +#### "seems to segfault with strict libc implementations" # $obj = "apple ${\(new Hlagh)} pear" #### $obj = "apple @{[new Hlagh]} pear" #### -s/dongs/new Hlagh/e; -#### exec $x $x, @a; #### exec { $a[0] } @a;