summaryrefslogtreecommitdiffstats
path: root/t/023-FOREIGNBUILDARGS.t
diff options
context:
space:
mode:
Diffstat (limited to 't/023-FOREIGNBUILDARGS.t')
-rw-r--r--t/023-FOREIGNBUILDARGS.t11
1 files changed, 7 insertions, 4 deletions
diff --git a/t/023-FOREIGNBUILDARGS.t b/t/023-FOREIGNBUILDARGS.t
index 8f93b79..c4e1398 100644
--- a/t/023-FOREIGNBUILDARGS.t
+++ b/t/023-FOREIGNBUILDARGS.t
@@ -1,16 +1,17 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More tests => 4;
package Foo;
sub new {
my $class = shift;
- bless { foo => $_[0] }, $class;
+ warn "@_";
+ bless { foo_base => $_[0] }, $class;
}
-sub foo { shift->{foo} }
+sub foo_base { shift->{foo_base} }
package Foo::Moose;
use Moose;
@@ -24,13 +25,15 @@ has foo => (
sub FOREIGNBUILDARGS {
my $class = shift;
my %args = @_;
- return $args{foo};
+ return "$args{foo}_base";
}
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');
Foo::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)');