Acme-use-strict-with-pride
view release on metacpan or search on metacpan
t/naughty_modules.t view on Meta::CPAN
use GagMe;
# Aargh. WTF is test harness doing turning on warnings when I explicity
# don't want them?
$^W = 0;
$SIG{__WARN__} = sub {print STDERR $_[0]};
# Test things misbehave as expected without Acme::use::strict::with::pride
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?");
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
use lib 't';
use Test::More tests => 9;
use GagMe;
$SIG{__WARN__} = sub {print STDERR $_[0]};
use Acme::use::strict::with::pride;
ok(1); # If we made it this far, we're ok.
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 0.971 second using v1.01-cache-2.11-cpan-49f99fa48dc )