From: Florian Ragwitz Date: Tue, 1 Dec 2009 16:35:20 +0000 (+0100) Subject: Fix testsuite warnings. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fa08825547fd3873476bcf7eee805ce3015492f9;p=gitmo%2FMoose.git Fix testsuite warnings. --- diff --git a/lib/Moose/Cookbook/Meta/Recipe7.pod b/lib/Moose/Cookbook/Meta/Recipe7.pod index 6ee9763..c2b8932 100644 --- a/lib/Moose/Cookbook/Meta/Recipe7.pod +++ b/lib/Moose/Cookbook/Meta/Recipe7.pod @@ -12,6 +12,9 @@ # My::Meta::Instance would be in a separate file from MyApp::User, # and this would be a non-issue. BEGIN { extends 'Moose::Meta::Instance' } + + # unimport again to prevent the subsequent "use Moose" from warning. + no Moose; } =end testing-SETUP diff --git a/t/020_attributes/004_attribute_triggers.t b/t/020_attributes/004_attribute_triggers.t index b8ec580..39b2208 100644 --- a/t/020_attributes/004_attribute_triggers.t +++ b/t/020_attributes/004_attribute_triggers.t @@ -161,61 +161,61 @@ use Test::Exception; # receive the old value { - package Foo; + package FooBar; use Moose; our @calls; has foo => (is => 'rw', trigger => sub { push @calls, [@_] }); } { - my $attr = Foo->meta->get_attribute('foo'); + my $attr = FooBar->meta->get_attribute('foo'); - my $foo = Foo->new; + my $foo = FooBar->new; $attr->set_value( $foo, 2 ); is_deeply( - \@Foo::calls, + \@FooBar::calls, [ [ $foo, 2 ] ], 'trigger called correctly on initial set via meta-API', ); - @Foo::calls = (); + @FooBar::calls = (); $attr->set_value( $foo, 3 ); is_deeply( - \@Foo::calls, + \@FooBar::calls, [ [ $foo, 3, 2 ] ], 'trigger called correctly on second set via meta-API', ); - @Foo::calls = (); + @FooBar::calls = (); $attr->set_raw_value( $foo, 4 ); is_deeply( - \@Foo::calls, + \@FooBar::calls, [ ], 'trigger not called using set_raw_value method', ); - @Foo::calls = (); + @FooBar::calls = (); } { - my $foo = Foo->new(foo => 2); + my $foo = FooBar->new(foo => 2); is_deeply( - \@Foo::calls, + \@FooBar::calls, [ [ $foo, 2 ] ], 'trigger called correctly on construction', ); - @Foo::calls = (); + @FooBar::calls = (); $foo->foo(3); is_deeply( - \@Foo::calls, + \@FooBar::calls, [ [ $foo, 3, 2 ] ], 'trigger called correctly on set (with old value)', ); - @Foo::calls = (); - Foo->meta->make_immutable, redo if Foo->meta->is_mutable; + @FooBar::calls = (); + FooBar->meta->make_immutable, redo if FooBar->meta->is_mutable; } done_testing; diff --git a/t/050_metaclasses/013_metaclass_traits.t b/t/050_metaclasses/013_metaclass_traits.t index b47cea4..49870a0 100644 --- a/t/050_metaclasses/013_metaclass_traits.t +++ b/t/050_metaclasses/013_metaclass_traits.t @@ -54,17 +54,17 @@ is( Bar->meta()->simple(), 5, } { - package Bar; + package FooBar; use Moose -traits => [ 'My::SimpleTrait2' ]; } -can_ok( Bar->meta(), 'simple' ); -is( Bar->meta()->simple(), 5, - 'Bar->meta()->simple() returns expected value' ); -can_ok( Bar->meta(), 'attr' ); -is( Bar->meta()->attr(), 'something', - 'Bar->meta()->attr() returns expected value' ); +can_ok( FooBar->meta(), 'simple' ); +is( FooBar->meta()->simple(), 5, + 'FooBar->meta()->simple() returns expected value' ); +can_ok( FooBar->meta(), 'attr' ); +is( FooBar->meta()->attr(), 'something', + 'FooBar->meta()->attr() returns expected value' ); { package My::SimpleTrait3; diff --git a/t/060_compat/001_module_refresh_compat.t b/t/060_compat/001_module_refresh_compat.t index 7ba1407..0dd9c2d 100644 --- a/t/060_compat/001_module_refresh_compat.t +++ b/t/060_compat/001_module_refresh_compat.t @@ -44,6 +44,7 @@ my $test_module_source_1 = q| package TestBaz; use Moose; has 'foo' => (is => 'ro', isa => 'Int'); +no Moose; 1; |; @@ -52,6 +53,7 @@ package TestBaz; use Moose; extends 'Foo'; has 'foo' => (is => 'rw', isa => 'Int'); +no Moose; 1; |; diff --git a/t/lib/Bar.pm b/t/lib/Bar.pm index fa1cfbd..64a4e51 100644 --- a/t/lib/Bar.pm +++ b/t/lib/Bar.pm @@ -7,4 +7,7 @@ type Baz => where { 1 }; subtype Bling => as Baz => where { 1 }; -1; \ No newline at end of file +no Moose; +no Moose::Util::TypeConstraints; + +1; diff --git a/t/lib/Foo.pm b/t/lib/Foo.pm index 9d5b13b..34c442e 100644 --- a/t/lib/Foo.pm +++ b/t/lib/Foo.pm @@ -4,4 +4,6 @@ use Moose; has 'bar' => (is => 'rw'); -1; \ No newline at end of file +no Moose; + +1; diff --git a/t/lib/MyMooseA.pm b/t/lib/MyMooseA.pm index 9e520b9..1f59d31 100644 --- a/t/lib/MyMooseA.pm +++ b/t/lib/MyMooseA.pm @@ -4,4 +4,6 @@ use Moose; has 'b' => (is => 'rw', isa => 'MyMooseB'); -1; \ No newline at end of file +no Moose; + +1; diff --git a/t/lib/MyMooseB.pm b/t/lib/MyMooseB.pm index c772947..347fc9d 100644 --- a/t/lib/MyMooseB.pm +++ b/t/lib/MyMooseB.pm @@ -2,4 +2,6 @@ package MyMooseB; use Moose; -1; \ No newline at end of file +no Moose; + +1;