diff options
Diffstat (limited to 't/10_private_method.t')
-rw-r--r-- | t/10_private_method.t | 27 |
1 files changed, 16 insertions, 11 deletions
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'; |