diff options
author | Jason May <jason.a.may@gmail.com> | 2009-05-06 13:19:21 -0400 |
---|---|---|
committer | Jason May <jason.a.may@gmail.com> | 2009-05-06 13:19:21 -0400 |
commit | 15c46ecd6f3206641e7bbbae2e2125ad5f2144bf (patch) | |
tree | c018127503b7d2fb16b4a6d67791c3350d656c03 /t | |
parent | 11dd3a027efbefeaae5ca483296781fa2bc5684d (diff) | |
download | moosex-nonmoose-15c46ecd6f3206641e7bbbae2e2125ad5f2144bf.tar.gz moosex-nonmoose-15c46ecd6f3206641e7bbbae2e2125ad5f2144bf.zip |
test base class functionality in FOREIGNBUILDARGS test
Diffstat (limited to 't')
-rw-r--r-- | t/023-FOREIGNBUILDARGS.t | 11 |
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)'); |