From: Dave Rolsky Date: Fri, 16 Sep 2011 15:40:27 +0000 (-0500) Subject: Tidy existing code X-Git-Tag: 2.0300~63 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMoose.git;a=commitdiff_plain;h=e0dc8e65d7809d82c175cc367cc7517d4f7155b5 Tidy existing code --- diff --git a/t/attributes/accessor_override_method.t b/t/attributes/accessor_override_method.t index d3c1a58..5c12716 100644 --- a/t/attributes/accessor_override_method.t +++ b/t/attributes/accessor_override_method.t @@ -4,33 +4,51 @@ use warnings; use Test::More; use Test::Requires { - 'Test::Output' => '0.01', # skip all if not installed + 'Test::Output' => '0.01', # skip all if not installed }; { + package Foo; use Moose; - sub get_a { } - sub set_b { } - sub has_c { } + sub get_a { } + sub set_b { } + sub has_c { } sub clear_d { } - sub e { } + sub e { } } my $foo_meta = Foo->meta; -stderr_like(sub { $foo_meta->add_attribute(a => (reader => 'get_a')) }, - qr/^You are overwriting a locally defined method \(get_a\) with an accessor/, 'reader overriding gives proper warning'); -stderr_like(sub { $foo_meta->add_attribute(b => (writer => 'set_b')) }, - qr/^You are overwriting a locally defined method \(set_b\) with an accessor/, 'writer overriding gives proper warning'); -stderr_like(sub { $foo_meta->add_attribute(c => (predicate => 'has_c')) }, - qr/^You are overwriting a locally defined method \(has_c\) with an accessor/, 'predicate overriding gives proper warning'); -stderr_like(sub { $foo_meta->add_attribute(d => (clearer => 'clear_d')) }, - qr/^You are overwriting a locally defined method \(clear_d\) with an accessor/, 'clearer overriding gives proper warning'); -stderr_like(sub { $foo_meta->add_attribute(e => (is => 'rw')) }, - qr/^You are overwriting a locally defined method \(e\) with an accessor/, 'accessor overriding gives proper warning'); - -stderr_like(sub { $foo_meta->add_attribute(has => (is => 'rw')) }, - qr/^You are overwriting a locally defined function \(has\) with an accessor/, 'function overriding gives proper warning'); +stderr_like( + sub { $foo_meta->add_attribute( a => ( reader => 'get_a' ) ) }, + qr/^You are overwriting a locally defined method \(get_a\) with an accessor/, + 'reader overriding gives proper warning' +); +stderr_like( + sub { $foo_meta->add_attribute( b => ( writer => 'set_b' ) ) }, + qr/^You are overwriting a locally defined method \(set_b\) with an accessor/, + 'writer overriding gives proper warning' +); +stderr_like( + sub { $foo_meta->add_attribute( c => ( predicate => 'has_c' ) ) }, + qr/^You are overwriting a locally defined method \(has_c\) with an accessor/, + 'predicate overriding gives proper warning' +); +stderr_like( + sub { $foo_meta->add_attribute( d => ( clearer => 'clear_d' ) ) }, + qr/^You are overwriting a locally defined method \(clear_d\) with an accessor/, + 'clearer overriding gives proper warning' +); +stderr_like( + sub { $foo_meta->add_attribute( e => ( is => 'rw' ) ) }, + qr/^You are overwriting a locally defined method \(e\) with an accessor/, + 'accessor overriding gives proper warning' +); +stderr_like( + sub { $foo_meta->add_attribute( has => ( is => 'rw' ) ) }, + qr/^You are overwriting a locally defined function \(has\) with an accessor/, + 'function overriding gives proper warning' +); done_testing;