X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=blobdiff_plain;f=t%2F20-bad.t;fp=t%2F20-bad.t;h=65511fd09a06f68cf1d1281179113a78c6b13e82;hp=35c8723ff752ebb26573ee24ca5e2ab323a2ddb4;hb=256486fe8cf158890b5bd5048d7467d6809b4f2e;hpb=3b879bdf6ec7035d353f6c6fdeff405633dbf493 diff --git a/t/20-bad.t b/t/20-bad.t index 35c8723..65511fd 100644 --- a/t/20-bad.t +++ b/t/20-bad.t @@ -23,35 +23,45 @@ sub expect { } { - local $/ = "####\n"; + local $/ = "####"; while () { chomp; s/\s*$//; + s/(.*?)$//m; + my ($skip, $prefix) = split /#+/, $1; + $skip = 0 unless defined $skip; + $prefix = '' unless defined $prefix; + s/\s*//; - local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) }; +SKIP: + { + skip "$_: $skip" => 6 if eval $skip; - eval "die qq{ok\\n}; use indirect; $_"; - is($@, "ok\n", "use indirect: $_"); + local $SIG{__WARN__} = sub { die 'warn:' . join(' ', @_) }; - eval "die qq{the code compiled but it shouldn't have\n}; no indirect; $_"; - like($@, expect('Hlagh'), "no indirect: $_"); + eval "die qq{ok\\n}; $prefix; use indirect; $_"; + is($@, "ok\n", "use indirect: $_"); - s/Hlagh/Dongs/g; + eval "die qq{the code compiled but it shouldn't have\n}; $prefix; no indirect; $_"; + like($@, expect('Hlagh'), "no indirect: $_"); - eval "die qq{ok\\n}; use indirect; $_"; - is($@, "ok\n", "use indirect, defined: $_"); + s/Hlagh/Dongs/g; - eval "die qq{the code compiled but it shouldn't have\n}; no indirect; $_"; - like($@, expect('Dongs'), "no indirect, defined: $_"); + eval "die qq{ok\\n}; $prefix; use indirect; $_"; + is($@, "ok\n", "use indirect, defined: $_"); - s/\$/\$ \n\t /g; - s/Dongs/Hlagh/g; + eval "die qq{the code compiled but it shouldn't have\n}; $prefix; no indirect; $_"; + like($@, expect('Dongs'), "no indirect, defined: $_"); - eval "die qq{ok\\n}; use indirect; $_"; - is($@, "ok\n", "use indirect, spaces: $_"); + s/\$/\$ \n\t /g; + s/Dongs/Hlagh/g; - eval "die qq{the code compiled but it shouldn't have\n}; no indirect; $_"; - like($@, expect('Hlagh'), "no indirect, spaces: $_"); + eval "die qq{ok\\n}; $prefix; use indirect; $_"; + is($@, "ok\n", "use indirect, spaces: $_"); + + eval "die qq{the code compiled but it shouldn't have\n}; $prefix; no indirect; $_"; + like($@, expect('Hlagh'), "no indirect, spaces: $_"); + } } } @@ -64,6 +74,7 @@ eval { } __DATA__ + $obj = new Hlagh; #### $obj = new Hlagh();