summaryrefslogtreecommitdiffstats
path: root/t/23-FOREIGNBUILDARGS.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-06-15 03:39:08 -0500
committerJesse Luehrs <doy@tozt.net>2010-06-15 03:39:08 -0500
commitdfc2ff5f2709f198d9fdb21d84a2534acc9f3670 (patch)
tree1e7792b6281cc26c634552d0b3a34ac73653fc62 /t/23-FOREIGNBUILDARGS.t
parenteaf8ccad64a0ca7a5f69ce884753a395f4c196fc (diff)
downloadmoosex-nonmoose-dfc2ff5f2709f198d9fdb21d84a2534acc9f3670.tar.gz
moosex-nonmoose-dfc2ff5f2709f198d9fdb21d84a2534acc9f3670.zip
make more tests use with_immutable
Diffstat (limited to 't/23-FOREIGNBUILDARGS.t')
-rw-r--r--t/23-FOREIGNBUILDARGS.t33
1 files changed, 12 insertions, 21 deletions
diff --git a/t/23-FOREIGNBUILDARGS.t b/t/23-FOREIGNBUILDARGS.t
index 43529dd..a9e8cef 100644
--- a/t/23-FOREIGNBUILDARGS.t
+++ b/t/23-FOREIGNBUILDARGS.t
@@ -2,6 +2,7 @@
use strict;
use warnings;
use Test::More tests => 12;
+use Test::Moose;
package Foo;
@@ -56,24 +57,14 @@ has baz => (
package main;
-my $foo = Foo::Moose->new(foo => 'bar');
-is($foo->foo, 'bar', 'subclass constructor gets the right args');
-is($foo->foo_base, 'bar_base', 'subclass constructor gets the right args');
-my $bar = Bar::Moose->new('baz');
-is($bar->bar, 'baz', 'subclass constructor gets the right args');
-is($bar->foo_base, 'baz_base', 'subclass constructor gets the right args');
-my $baz = Baz::Moose->new('bazbaz');
-is($baz->bar, 'bazbaz', 'extensions of extensions of the nonmoose class respect BUILDARGS');
-is($baz->foo_base, 'bazbaz_base', 'extensions of extensions of the nonmoose class respect FOREIGNBUILDARGS');
-Foo::Moose->meta->make_immutable;
-Bar::Moose->meta->make_immutable;
-Baz::Moose->meta->make_immutable;
-$foo = Foo::Moose->new(foo => 'bar');
-is($foo->foo, 'bar', 'subclass constructor gets the right args (immutable)');
-is($foo->foo_base, 'bar_base', 'subclass constructor gets the right args (immutable)');
-$bar = Bar::Moose->new('baz');
-is($bar->bar, 'baz', 'subclass constructor gets the right args (immutable)');
-is($bar->foo_base, 'baz_base', 'subclass constructor gets the right args (immutable)');
-$baz = Baz::Moose->new('bazbaz');
-is($baz->bar, 'bazbaz', 'extensions of extensions of the nonmoose class respect BUILDARGS (immutable)');
-is($baz->foo_base, 'bazbaz_base', 'extensions of extensions of the nonmoose class respect FOREIGNBUILDARGS (immutable)');
+with_immutable {
+ my $foo = Foo::Moose->new(foo => 'bar');
+ is($foo->foo, 'bar', 'subclass constructor gets the right args');
+ is($foo->foo_base, 'bar_base', 'subclass constructor gets the right args');
+ my $bar = Bar::Moose->new('baz');
+ is($bar->bar, 'baz', 'subclass constructor gets the right args');
+ is($bar->foo_base, 'baz_base', 'subclass constructor gets the right args');
+ my $baz = Baz::Moose->new('bazbaz');
+ is($baz->bar, 'bazbaz', 'extensions of extensions of the nonmoose class respect BUILDARGS');
+ is($baz->foo_base, 'bazbaz_base', 'extensions of extensions of the nonmoose class respect FOREIGNBUILDARGS');
+} qw(Foo::Moose Bar::Moose Baz::Moose);