Acme-use-strict-with-pride

 view release on metacpan or  search on metacpan

t/Bad.pm  view on Meta::CPAN

package Bad;
BEGIN {$::loaded{+__PACKAGE__}++;}
my ($a);

# It's true, but it's undefined. And it's line 5
$a = 5 + $a;

t/naughty_modules.t  view on Meta::CPAN

is ($@, "", "without an error");
is ($::loaded{Bad}, 1, "Bad did actually get loaded?");
is ($debug->read, '', "There should be no warnings");

is (eval "use Naughty; 2", 2, "Should be able to use Naughty");
is ($@, "", "without an error");
is ($debug->read, '', "There should be no warnings");

is ($::loaded{Naughty}, 1, "Naughty did actually get loaded?");

undef $debug;
untie *STDERR;

t/whip_them_into_line.t  view on Meta::CPAN


my $debug = tie *STDERR, 'GagMe';

is (eval "require Bad; 2", 2, "Should be able to use Bad");
is ($@, "", "without an error");
is ($::loaded{Bad}, 1, "Bad did actually get loaded?");
like ($debug->read,
  qr!^Use of uninitialized value(?: \$a)? in addition \(\+\) at t/Bad.pm line 6\.$!,
      "Is the error properly mangled");

is (eval "use Naughty; 2", undef, "Should not be able to use Naughty");
like ($@, qr!Global symbol "\$what_am_i" requires explicit package name at t/Naughty.pm line 4.!,
      "Is the error properly mangled");

is ($debug->read, '', "eval should have caught the error");

is ($::loaded{Naughty}, 1, "Naughty did actually get loaded?");

undef $debug;
untie *STDERR;



( run in 1.627 second using v1.01-cache-2.11-cpan-d80b1682f3f )