X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=t%2F22-bad-mixed.t;fp=t%2F22-bad-mixed.t;h=bbc2f23eb8f959e23987b99d99b50d144b40a975;hb=f4e7787d7c015980abba9a8d76f0293f24e0ab94;hp=0000000000000000000000000000000000000000;hpb=8f6050c13ab62f0b935a179c71e9832f5d4f0d79;p=perl%2Fmodules%2Findirect.git diff --git a/t/22-bad-mixed.t b/t/22-bad-mixed.t new file mode 100644 index 0000000..bbc2f23 --- /dev/null +++ b/t/22-bad-mixed.t @@ -0,0 +1,50 @@ +#!perl -T + +package Dongs; + +sub new; + +package main; + +use strict; +use warnings; + +use Test::More tests => 3 * 4; + +sub meh; + +{ + local $/ = "####\n"; + 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: $_"); + { + no indirect; + eval "die qq{the code compiled but it shouldn't have\n}; $_"; + } + like($@, qr/^warn:Indirect\s+call\s+of\s+method\s+"meh"\s+on\s+object\s+"Dongs"/, "no indirect, defined: $_"); + } +} + +__DATA__ +meh Hlagh->new; +#### +meh Hlagh->new(); +#### +meh Hlagh->new, "Wut";