Remove references to jules git repo
[gitmo/Moose.git] / t / 020_attributes / 027_accessor_override_method.t
CommitLineData
baf17065 1#!/usr/bin/env perl
2use strict;
3use warnings;
4use Test::More;
5
6BEGIN {
7 eval "use Test::Output;";
8 plan skip_all => "Test::Output is required for this test" if $@;
9 plan tests => 5;
10}
11
12{
13 package Foo;
14 use Moose;
15
16 sub get_a { }
17 sub set_b { }
18 sub has_c { }
19 sub clear_d { }
20 sub e { }
21}
22
23my $foo_meta = Foo->meta;
24stderr_like(sub { $foo_meta->add_attribute(a => (reader => 'get_a')) },
1d18c898 25 qr/^You are overwriting a locally defined method \(get_a\) with an accessor/, 'reader overriding gives proper warning');
baf17065 26stderr_like(sub { $foo_meta->add_attribute(b => (writer => 'set_b')) },
1d18c898 27 qr/^You are overwriting a locally defined method \(set_b\) with an accessor/, 'writer overriding gives proper warning');
baf17065 28stderr_like(sub { $foo_meta->add_attribute(c => (predicate => 'has_c')) },
1d18c898 29 qr/^You are overwriting a locally defined method \(has_c\) with an accessor/, 'predicate overriding gives proper warning');
baf17065 30stderr_like(sub { $foo_meta->add_attribute(d => (clearer => 'clear_d')) },
1d18c898 31 qr/^You are overwriting a locally defined method \(clear_d\) with an accessor/, 'clearer overriding gives proper warning');
baf17065 32stderr_like(sub { $foo_meta->add_attribute(e => (is => 'rw')) },
1d18c898 33 qr/^You are overwriting a locally defined method \(e\) with an accessor/, 'accessor overriding gives proper warning');