X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2Findirect.git;a=blobdiff_plain;f=t%2F20-bad.t;h=5c57ebed84a6a2b65e26ee44470402101e460b6b;hp=ce17983eaaf1c7bc71818828a47b9220c19c2c5d;hb=5354a80a6d86689d016d5fc9e68f2a64f875a8f3;hpb=7808ca5448054d4528a34984d0068ae38f0ac9e9 diff --git a/t/20-bad.t b/t/20-bad.t index ce17983..5c57ebe 100644 --- a/t/20-bad.t +++ b/t/20-bad.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 30 * 2; +use Test::More tests => 30 * 2 + 2; my ($obj, $x); @@ -26,6 +26,16 @@ my ($obj, $x); } } +eval { + no indirect 'hlagh'; + my $warn; + local $SIG{__WARN__} = sub { $warn = join ' ', @_ }; + eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh1;"; + like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh1"/, 'no indirect "hlagh" enables the pragma'); + eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh2;"; + like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh2"/, 'no indirect "hlagh" doesn\'t croak'); +} + __DATA__ $obj = new Hlagh; ####