Commit | Line | Data |
1f5ce14a |
1 | #!/usr/bin/env perl |
2 | # This is automatically generated by author/import-moose-test.pl. |
3 | # DO NOT EDIT THIS FILE. ANY CHANGES WILL BE LOST!!! |
4 | use t::lib::MooseCompat; |
5 | use strict; |
6 | use warnings; |
7 | use Test::More; |
8 | $TODO = q{Mouse is not yet completed}; |
9 | |
10 | use Test::Requires { |
11 | 'Test::Output' => '0.01', # skip all if not installed |
12 | }; |
13 | |
14 | { |
15 | package Foo; |
16 | use Mouse; |
17 | |
18 | sub get_a { } |
19 | sub set_b { } |
20 | sub has_c { } |
21 | sub clear_d { } |
22 | sub e { } |
23 | } |
24 | |
25 | my $foo_meta = Foo->meta; |
26 | stderr_like(sub { $foo_meta->add_attribute(a => (reader => 'get_a')) }, |
27 | qr/^You are overwriting a locally defined method \(get_a\) with an accessor/, 'reader overriding gives proper warning'); |
28 | stderr_like(sub { $foo_meta->add_attribute(b => (writer => 'set_b')) }, |
29 | qr/^You are overwriting a locally defined method \(set_b\) with an accessor/, 'writer overriding gives proper warning'); |
30 | stderr_like(sub { $foo_meta->add_attribute(c => (predicate => 'has_c')) }, |
31 | qr/^You are overwriting a locally defined method \(has_c\) with an accessor/, 'predicate overriding gives proper warning'); |
32 | stderr_like(sub { $foo_meta->add_attribute(d => (clearer => 'clear_d')) }, |
33 | qr/^You are overwriting a locally defined method \(clear_d\) with an accessor/, 'clearer overriding gives proper warning'); |
34 | stderr_like(sub { $foo_meta->add_attribute(e => (is => 'rw')) }, |
35 | qr/^You are overwriting a locally defined method \(e\) with an accessor/, 'accessor overriding gives proper warning'); |
36 | |
37 | stderr_like(sub { $foo_meta->add_attribute(has => (is => 'rw')) }, |
38 | qr/^You are overwriting a locally defined function \(has\) with an accessor/, 'function overriding gives proper warning'); |
39 | |
40 | done_testing; |