1#!/usr/bin/env perl
2use strict;
3use warnings;
4use Test::More;
5
6package Foo;
7
8sub new {
9    my $class = shift;
10    bless {}, $class;
11}
12
13package Foo::Moose;
14use Moose;
15use MooseX::NonMoose;
16extends 'Foo';
17
18package Foo::Moose2;
19use Moose;
20use MooseX::NonMoose;
21extends 'Foo';
22
23package main;
24
25ok(Foo::Moose->meta->has_method('new'), 'Foo::Moose has a constructor');
26my $method = Foo::Moose->meta->get_method('new');
27Foo::Moose->meta->make_immutable;
28isnt($method, Foo::Moose->meta->get_method('new'),
29     'make_immutable replaced the constructor with an inlined version');
30my $method2 = Foo::Moose2->meta->get_method('new');
31Foo::Moose2->meta->make_immutable(inline_constructor => 0);
32is($method2, Foo::Moose2->meta->get_method('new'),
33   'make_immutable doesn\'t replace the constructor if we ask it not to');
34
35done_testing;
36