added little test for warning when an attribute overrides an implemented method
Robert Buels [Mon, 22 Jun 2009 14:09:48 +0000 (07:09 -0700)]
t/010_basics/021_attr_override_method_warning.t [new file with mode: 0644]

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 (file)
index 0000000..73701cb
--- /dev/null
@@ -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');
+