From: Robert Buels <rmb32@cornell.edu>
Date: Mon, 22 Jun 2009 14:09:48 +0000 (-0700)
Subject: added little test for warning when an attribute overrides an implemented method
X-Git-Tag: 0.84~25^2~2
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d111406db5c6624c6364c4be212737b3ac1e49cc;p=gitmo%2FMoose.git

added little test for warning when an attribute overrides an implemented method
---

diff --git a/t/010_basics/021_attr_override_method_warning.t b/t/010_basics/021_attr_override_method_warning.t
new file mode 100644
index 0000000..73701cb
--- /dev/null
+++ b/t/010_basics/021_attr_override_method_warning.t
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+use English;
+
+use Test::More tests => 2;
+
+my @warnings;
+local $SIG{__WARN__} = sub { push @warnings,@_ };
+    eval <<EOP;
+package MyThingy;
+use Moose;
+
+has foo => ( is => 'rw' );
+sub foo { 'omglolbbq' }
+
+package main;
+EOP
+
+is( scalar(@warnings), 1, 'got 1 warning' );
+like( $warnings[0], qr/\bfoo\b.+redefine/, 'got a redefinition warning that mentions redefining or overriding or something');
+