Add tests for warning on $object->new and implement immutable version of warning.
[gitmo/Moose.git] / t / 010_basics / 021-instance-new.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5 use Test::Exception;
6 BEGIN {
7     eval "use Test::Output;";
8     plan skip_all => "Test::Output is required for this test" if $@;
9     plan tests => 2;
10 }
11
12 {
13     package Foo;
14     use Moose;
15 }
16
17 {
18     my $foo = Foo->new();
19     stderr_like { $foo->new() }
20     qr/\QCalling new() on an instance is deprecated/,
21         '$object->new() is deprecated';
22
23     Foo->meta->make_immutable, redo
24         if Foo->meta->is_mutable;
25 }