From c8d40ecee67b80a8665eb0928882cb7fa2d15fde Mon Sep 17 00:00:00 2001 From: franck cuny Date: Thu, 29 Apr 2010 09:16:10 +0200 Subject: update tests, use with_immutable --- t/10_private_method.t | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 't/10_private_method.t') diff --git a/t/10_private_method.t b/t/10_private_method.t index b2f3056..9948983 100644 --- a/t/10_private_method.t +++ b/t/10_private_method.t @@ -1,8 +1,9 @@ use strict; use warnings; -use Test::More tests => 7; +use Test::More tests => 14; use Test::Exception; +use Test::Moose; { @@ -45,16 +46,20 @@ use Test::Exception; } } -my $foo = Foo->new(); -isa_ok( $foo, 'Foo' ); -dies_ok { $foo->bar } "... can't call bar, method is private"; -is $foo->baz, 'baz', "... got the good value from &baz"; -is $foo->foo('baz'), 'foobarbaz', "... got the good value from &foobar"; +with_immutable { + my $foo = Foo->new(); + isa_ok( $foo, 'Foo' ); + dies_ok { $foo->bar } "... can't call bar, method is private"; + is $foo->baz, 'baz', "... got the good value from &baz"; + is $foo->foo('baz'), 'foobarbaz', "... got the good value from &foobar"; + my $bar = Bar->new(); + isa_ok( $bar, 'Bar' ); + dies_ok { $bar->newbar() } "... can't call bar, method is private"; + + is scalar @{ $foo->meta->local_private_methods }, 2, + '... got two privates method'; +} +(qw/Foo Bar/); -my $bar = Bar->new(); -isa_ok( $bar, 'Bar' ); -dies_ok { $bar->newbar() } "... can't call bar, method is private"; -is scalar @{ $foo->meta->local_private_methods }, 2, - '... got two privates method'; -- cgit v1.2.3