summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJason May <jason.a.may@gmail.com>2009-05-06 13:12:50 -0400
committerJason May <jason.a.may@gmail.com>2009-05-06 13:12:50 -0400
commit11dd3a027efbefeaae5ca483296781fa2bc5684d (patch)
tree05101650fc9e9f81d9d3d936b20a5188f3b0130e /t
parent94ca14721241ff804bab06c56867574887dcd907 (diff)
downloadmoosex-nonmoose-11dd3a027efbefeaae5ca483296781fa2bc5684d.tar.gz
moosex-nonmoose-11dd3a027efbefeaae5ca483296781fa2bc5684d.zip
test for FOREIGNBUILDARGS
Diffstat (limited to 't')
-rw-r--r--t/023-FOREIGNBUILDARGS.t36
1 files changed, 36 insertions, 0 deletions
diff --git a/t/023-FOREIGNBUILDARGS.t b/t/023-FOREIGNBUILDARGS.t
new file mode 100644
index 0000000..8f93b79
--- /dev/null
+++ b/t/023-FOREIGNBUILDARGS.t
@@ -0,0 +1,36 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+package Foo;
+
+sub new {
+ my $class = shift;
+ bless { foo => $_[0] }, $class;
+}
+
+sub foo { shift->{foo} }
+
+package Foo::Moose;
+use Moose;
+use MooseX::NonMoose;
+extends 'Foo';
+
+has foo => (
+ is => 'rw',
+);
+
+sub FOREIGNBUILDARGS {
+ my $class = shift;
+ my %args = @_;
+ return $args{foo};
+}
+
+package main;
+
+my $foo = Foo::Moose->new(foo => 'bar');
+is($foo->foo, 'bar', '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)');