diff options
author | doy <doy@tozt.net> | 2009-04-20 00:31:16 -0500 |
---|---|---|
committer | doy <doy@tozt.net> | 2009-04-20 00:31:16 -0500 |
commit | 1224d2b9a3965e40a9c5605eb455ff8a3372380b (patch) | |
tree | 188e04547a5165edb3d8a92a7a62c0e41f74c8c0 | |
parent | e953fbcde9b98a9f2397dd7e8e36ff4d1beb4757 (diff) | |
download | moosex-nonmoose-1224d2b9a3965e40a9c5605eb455ff8a3372380b.tar.gz moosex-nonmoose-1224d2b9a3965e40a9c5605eb455ff8a3372380b.zip |
add a test for inline_constructor => 0
-rw-r--r-- | t/006-disable.t | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/t/006-disable.t b/t/006-disable.t new file mode 100644 index 0000000..aea55ec --- /dev/null +++ b/t/006-disable.t @@ -0,0 +1,33 @@ +#!/usr/bin/env perl +use strict; +use warnings; +use Test::More tests => 3; + +package Foo; + +sub new { + my $class = shift; + bless {}, $class; +} + +package Foo::Moose; +use Moose; +use MooseX::NonMoose; +extends 'Foo'; + +package Foo::Moose2; +use Moose; +use MooseX::NonMoose; +extends 'Foo'; + +package main; + +ok(Foo::Moose->meta->has_method('new'), 'Foo::Moose has a constructor'); +my $method = Foo::Moose->meta->get_method('new'); +Foo::Moose->meta->make_immutable; +isnt($method, Foo::Moose->meta->get_method('new'), + 'make_immutable replaced the constructor with an inlined version'); +my $method2 = Foo::Moose2->meta->get_method('new'); +Foo::Moose->meta->make_immutable(inline_constructor => 0); +is($method2, Foo::Moose2->meta->get_method('new'), + 'make_immutable doesn\'t replace the constructor if we ask it not to'); |