Merge some tests to one file
gfx [Mon, 11 Jan 2010 06:40:51 +0000 (15:40 +0900)]
t/001_mouse/001-strict-and-warnings.t [new file with mode: 0644]
t/001_mouse/001-strict.t [deleted file]
t/001_mouse/002-warnings.t [deleted file]
t/001_mouse/003-mouse-object.t [deleted 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 (file)
index 0000000..9253d22
--- /dev/null
@@ -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 (file)
index fb82c0e..0000000
+++ /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 (file)
index f5195aa..0000000
+++ /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 (file)
index d47a00d..0000000
+++ /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');