rsrchboy / Test-Moose-More

More tools for testing Moose packages
http://metacpan.org/release/Test-Moose-More/
Other
3 stars 8 forks source link

Tests fail maybe due to different Moose diagnostics #5

Closed ppisar closed 11 years ago

ppisar commented 11 years ago

I experience these failures:

   Failed test 'validate_attribute works correctly'
#   at t/validate_attribute.t line 77.
# STDOUT is:
# ok 1 - TestClass has an attribute named foo
# ok 2 - Moose::Meta::Class::__ANON__::SERIAL::1 has a metaclass
# ok 3 - Moose::Meta::Class::__ANON__::SERIAL::1 is a Moose class
# ok 4 - An object of class 'Moose::Meta::Class::__ANON__::SERIAL::1' isa 'Moose::Meta::Attribute'
# ok 5 - Moose::Meta::Class::__ANON__::SERIAL::1 does TestRole
# ok 6 - foo is required
# ok 7 - foo has a builder
# ok 8 - foo option builder correct
# ok 9 - foo does not have a default
# ok 10 - foo option default correct
# ok 11 - foo has a reader
# ok 12 - foo option reader correct
# ok 13 # skip cannot test 'isa' options yet
# ok 14 # skip cannot test 'does' options yet
# ok 15 # skip cannot test 'handles' options yet
# ok 16 # skip cannot test 'traits' options yet
# ok 17 - foo has a init_arg
# ok 18 - foo option init_arg correct
# ok 19 - foo is lazy
# not ok 20 - unknown attribute option: binger
# ok 21 - foo has a thinger
# ok 22 - foo option thinger correct
#
# not:
# ok 1 - TestClass has an attribute named foo
# ok 2 - Moose::Meta::Class::__ANON__::SERIAL::1 has a metaclass
# ok 3 - Moose::Meta::Class::__ANON__::SERIAL::1 is a Moose class
# ok 4 - The object isa Moose::Meta::Attribute
# ok 5 - Moose::Meta::Class::__ANON__::SERIAL::1 does TestRole
# ok 6 - foo is required
# ok 7 - foo has a builder
# ok 8 - foo option builder correct
# ok 9 - foo does not have a default
# ok 10 - foo option default correct
# ok 11 - foo has a reader
# ok 12 - foo option reader correct
# ok 13 # skip cannot test 'isa' options yet
# ok 14 # skip cannot test 'does' options yet
# ok 15 # skip cannot test 'handles' options yet
# ok 16 # skip cannot test 'traits' options yet
# ok 17 - foo has a init_arg
# ok 18 - foo option init_arg correct
# ok 19 - foo is lazy
# not ok 20 - unknown attribute option: binger
# ok 21 - foo has a thinger
# ok 22 - foo option thinger correct
#
# as expected
t/validate_attribute.t .......... Failed 1/4 subtests
t/validate_class.t .............. 1/?
#   Failed test 'validate_class works correctly for valid classes'
#   at t/validate_class.t line 65.
# STDOUT is:
# ok 1 - TestClass has a metaclass
# ok 2 - TestClass is a Moose class
# ok 3 - The class (or class-like) 'TestClass' isa 'Moose::Object'
# ok 4 - TestClass is not anonymous
# ok 5 - TestClass does TestRole
# ok 6 - TestClass does not do TestRole::Two
# ok 7 - TestClass has method foo
# ok 8 - TestClass has method method1
# ok 9 - TestClass has method has_bar
# ok 10 - TestClass has an attribute named bar
#
# not:
# ok 1 - TestClass has a metaclass
# ok 2 - TestClass is a Moose class
# ok 3 - The class isa Moose::Object
# ok 4 - TestClass is not anonymous
# ok 5 - TestClass does TestRole
# ok 6 - TestClass does not do TestRole::Two
# ok 7 - TestClass has method foo
# ok 8 - TestClass has method method1
# ok 9 - TestClass has method has_bar
# ok 10 - TestClass has an attribute named bar
#
# as expected
t/validate_class.t .............. Failed 1/7 subtests

I don't know where the message are coming from. But I think this is just a more verbose Moose diagnostics. My versions are:

t/000-report-versions-tiny.t .... #
#
# Generated by Dist::Zilla::Plugin::ReportVersions::Tiny v1.09
# perl: 5.018000 (wanted 5.006) on linux from /usr/bin/perl
#
# Capture::Tiny                                 => 0.22       (want any version)
# Class::MOP                                    => 2.0802     (want any version)
# Data::OptList                                 => 0.108      (want any version)
# ExtUtils::MakeMaker                           => 6.68       (want 6.30)
# Moose                                         => 2.0802     (want any version)
# Moose::Autobox                                => 0.12       (want any version)
# Moose::Role                                   => 2.0802     (want any version)
# Moose::Util                                   => 2.0802     (want any version)
# Moose::Util::TypeConstraints                  => 2.0802     (want any version)
# Pod::Coverage::TrustPod                       => module not found. (want any version)
# Scalar::Util                                  => 1.27       (want any version)
# Sub::Exporter                                 => 0.986      (want any version)
# Syntax::Keyword::Junction                     => 0.003004   (want any version)
# TAP::SimpleOutput                             => 0.001      (want any version)
# Test::Builder                                 => 0.9805     (want any version)
# Test::Builder::Tester                         => 1.23_002   (want any version)
# Test::Moose                                   => 2.0802     (want any version)
# Test::More                                    => 0.9805     (want 0.88)
# Test::Pod                                     => 1.48       (want 1.41)
# Test::Pod::Coverage                           => 1.08       (want 1.08)
# blib                                          => 1.06       (want any version)
# namespace::autoclean                          => 0.13       (want any version)
# strict                                        => 1.07       (want any version)
# version                                       => 0.9902     (want 0.9901)
# warnings                                      => 1.18       (want any version)
ppisar commented 11 years ago

So both failures are due to finer messages since SImple-Test-0.85_04.

ppisar commented 11 years ago

Fix:

diff --git a/t/validate_attribute.t b/t/validate_attribute.t
index e06f801..7692c5c 100644
--- a/t/validate_attribute.t
+++ b/t/validate_attribute.t
@@ -38,7 +38,11 @@ note 'validate attribute validation';
     test_out $_ok->('TestClass has an attribute named foo');
     test_out $_ok->(q{Moose::Meta::Class::__ANON__::SERIAL::1 has a metaclass});
     test_out $_ok->(q{Moose::Meta::Class::__ANON__::SERIAL::1 is a Moose class});
-    test_out $_ok->('The object isa Moose::Meta::Attribute');
+    if ($Test::More::VERSION < 0.9804) {
+        test_out $_ok->(q{The object isa Moose::Meta::Attribute});
+    } else {
+        test_out $_ok->(q{An object of class 'Moose::Meta::Class::__ANON__::SERIAL::1' isa 'Moose::Meta::Attribute'});
+    }
     test_out $_ok->('Moose::Meta::Class::__ANON__::SERIAL::1 does TestRole');
     test_out $_ok->('foo is required');
     test_out $_ok->('foo has a builder');
diff --git a/t/validate_class.t b/t/validate_class.t
index 4b183bf..c9e74e5 100644
--- a/t/validate_class.t
+++ b/t/validate_class.t
@@ -47,7 +47,11 @@ note 'validate w/valid class';
     my ($_ok, $_nok) = counters();
     test_out $_ok->('TestClass has a metaclass');
     test_out $_ok->('TestClass is a Moose class');
-    test_out $_ok->('The class isa Moose::Object');
+    if ($Test::More::VERSION < 0.9804) {
+        test_out $_ok->(q{The class isa Moose::Object});
+    } else {
+        test_out $_ok->(q{The class (or class-like) 'TestClass' isa 'Moose::Object'});
+    }
     test_out $_ok->('TestClass is not anonymous');
     test_out $_ok->('TestClass does TestRole');
     test_out $_ok->('TestClass does not do TestRole::Two');