Forgot to fix the test count
[gitmo/Moose.git] / t / 030_roles / 019_build.t
index ce0bce5..cd973cd 100644 (file)
@@ -1,7 +1,12 @@
 #!/usr/bin/env perl
 use strict;
 use warnings;
-use Test::More tests => 8;
+use Test::More;
+BEGIN {
+    eval "use Test::Output;";
+    plan skip_all => "Test::Output is required for this test" if $@;
+    plan tests => 8;
+}
 
 # this test script ensures that my idiom of:
 # role: sub BUILD, after BUILD
@@ -22,7 +27,10 @@ do {
 do {
     package ClassWithBUILD;
     use Moose;
-    with 'TestRole';
+
+    ::stderr_is {
+        with 'TestRole';
+    } '';
 
     sub BUILD { push @CALLS, 'ClassWithBUILD::BUILD' }
 };
@@ -30,7 +38,10 @@ do {
 do {
     package ExplicitClassWithBUILD;
     use Moose;
-    with 'TestRole' => { excludes => 'BUILD' };
+
+    ::stderr_is {
+        with 'TestRole' => { excludes => 'BUILD' };
+    } '';
 
     sub BUILD { push @CALLS, 'ExplicitClassWithBUILD::BUILD' }
 };
@@ -52,14 +63,6 @@ do {
         'TestRole::BUILD:after',
     ]);
 
-    ExplicitClassWithBUILD->new;
-
-    is_deeply([splice @CALLS], [
-        'TestRole::BUILD:before',
-        'ExplicitClassWithBUILD::BUILD',
-        'TestRole::BUILD:after',
-    ]);
-
     ClassWithoutBUILD->new;
 
     is_deeply([splice @CALLS], [
@@ -70,7 +73,6 @@ do {
 
     if (ClassWithBUILD->meta->is_mutable) {
         ClassWithBUILD->meta->make_immutable;
-        ExplicitClassWithBUILD->meta->make_immutable;
         ClassWithoutBUILD->meta->make_immutable;
         redo;
     }