summaryrefslogtreecommitdiffstats
path: root/t/23-FOREIGNBUILDARGS.t
diff options
context:
space:
mode:
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);