From: gfx Date: Mon, 11 Jan 2010 06:40:51 +0000 (+0900) Subject: Merge some tests to one file X-Git-Tag: 0.47~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0c5c3648c1cd9e2fb5ce6446a0f81fc944cf0829;p=gitmo%2FMouse.git Merge some tests to one file --- 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; diff --git a/t/001_mouse/001-strict.t b/t/001_mouse/001-strict.t deleted file mode 100644 index fb82c0e..0000000 --- a/t/001_mouse/001-strict.t +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env perl -use Test::More tests => 1; -use Test::Exception; - -throws_ok { - package Class; - use Mouse; - - my $foo = '$foo'; - chop $$foo; -} qr/Can't use string \("\$foo"\) as a SCALAR ref while "strict refs" in use /, - 'using Mouse turns on strictures'; - diff --git a/t/001_mouse/002-warnings.t b/t/001_mouse/002-warnings.t deleted file mode 100644 index f5195aa..0000000 --- a/t/001_mouse/002-warnings.t +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env perl -use Test::More tests => 1; - -# we used to use Test::Warn here but there's no point in adding three deps total -# for this one easy test - -my @warnings; -local $SIG{__WARN__} = sub { - push @warnings, "@_"; -}; - -do { - package Class; - use Mouse; - - my $one = 1 + undef; -}; - -like("@warnings", qr/^Use of uninitialized value/, 'using Mouse turns on warnings'); - diff --git a/t/001_mouse/003-mouse-object.t b/t/001_mouse/003-mouse-object.t deleted file mode 100644 index d47a00d..0000000 --- a/t/001_mouse/003-mouse-object.t +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use Test::More tests => 1; - -require Mouse; - -can_ok('Mouse::Object' => 'new');