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