X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F001_mouse%2F001-strict-and-warnings.t;fp=t%2F001_mouse%2F001-strict-and-warnings.t;h=9253d220baba1593b170a1b5866f561ddcfba06e;hb=0c5c3648c1cd9e2fb5ce6446a0f81fc944cf0829;hp=0000000000000000000000000000000000000000;hpb=fbba35c6f2393c3a4744cef9ce63f78ba82ddbad;p=gitmo%2FMouse.git diff --git a/t/001_mouse/001-strict-and-warnings.t b/t/001_mouse/001-strict-and-warnings.t new file mode 100644 index 0000000..9253d22 --- /dev/null +++ b/t/001_mouse/001-strict-and-warnings.t @@ -0,0 +1,40 @@ +#!/usr/bin/env perl +use Test::More; + +my $id = 0; +foreach my $mod (qw(Mouse Mouse::Role Mouse::Exporter)){ + $id++; + eval qq{ + no strict; + no warnings; + + package Class$id; + use $mod; + + my \$foo = 'foo'; + chop \$\$foo; + }; + like $@, qr/Can't use string \("foo"\) as a SCALAR ref while "strict refs" in use /, # ' + "using $mod turns on strictures"; + + my @warnings; + local $SIG{__WARN__} = sub { + push @warnings, @_; + }; + + $id++; + eval qq{ + no strict; + no warnings; + + package Class$id; + use $mod; + + my \$one = 1 + undef; + }; + is $@, ''; + + like("@warnings", qr/^Use of uninitialized value/, "using $mod turns on warnings"); +} + +done_testing;