This module doesn't need Moose::Deprecated
[gitmo/Moose.git] / t / 010_basics / 030_deprecations.t
1 use strict;
2 use warnings;
3
4 use Test::More;
5
6 use Test::Requires {
7     'Test::Output' => '0.01',
8 };
9
10 {
11     package Role;
12
13     use Moose::Role;
14
15     sub thing { }
16 }
17
18 {
19     package Foo;
20
21     use Moose;
22
23     ::stderr_like{ has foo => (
24             traits => ['String'],
25             is     => 'ro',
26             isa    => 'Str',
27         );
28         }
29         qr/\QAllowing a native trait to automatically supply a default is deprecated/,
30         'Not providing a default for native String trait warns';
31
32     ::stderr_like{ has bar => (
33             traits  => ['String'],
34             isa     => 'Str',
35             default => q{},
36         );
37         }
38         qr/\QAllowing a native trait to automatically supply a value for "is" is deprecated/,
39         'Not providing a value for is with native String trait warns';
40
41     ::stderr_like{ with 'Role' =>
42             { excludes => ['thing'], alias => { thing => 'thing2' } };
43         }
44         qr/\QThe alias and excludes options for role application have been renamed -alias and -excludes/,
45         'passing excludes or alias with a leading dash warns';
46     ::ok(
47         !Foo->meta->has_method('thing'),
48         'thing method is excluded from role application'
49     );
50     ::ok(
51         Foo->meta->has_method('thing2'),
52         'thing2 method is created as alias in role application'
53     );
54 }
55
56 done_testing;
57