From: Guillermo Roditi Date: Fri, 28 Mar 2008 19:39:57 +0000 (+0000) Subject: adding new test X-Git-Tag: 0_55~78^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b363712c7b08396a9dc8378e4523cf91298959fe;p=gitmo%2FMoose.git adding new test --- diff --git a/t/300_immutable/007_inlined_constructor_modified_new.t b/t/300_immutable/007_inlined_constructor_modified_new.t new file mode 100644 index 0000000..9c8f026 --- /dev/null +++ b/t/300_immutable/007_inlined_constructor_modified_new.t @@ -0,0 +1,30 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +use Test::More tests => 7; + +my ($around_new); +{ + package Foo; + use Moose; + + around new => sub { my $o = shift; $around_new = 1; $o->(@_); }; + has 'foo' => (is => 'rw', isa => 'Int'); +} + +my $orig_new = Foo->meta->find_method_by_name('new'); +isa_ok($orig_new, 'Class::MOP::Method::Wrapped'); +$orig_new = $orig_new->get_original_method; +isa_ok($orig_new, 'Moose::Meta::Method'); + +Foo->meta->make_immutable(debug => 0); +my $inlined_new = Foo->meta->find_method_by_name('new'); +isa_ok($inlined_new, 'Class::MOP::Method::Wrapped'); +$inlined_new = $inlined_new->get_original_method; +isa_ok($inlined_new, 'Moose::Meta::Method::Constructor'); + +my $foo = Foo->new(foo => 100); +ok($around_new, 'around new called'); +