summaryrefslogtreecommitdiff
path: root/t/attributes/accessor_overwrite_warning.t
diff options
context:
space:
mode:
Diffstat (limited to 't/attributes/accessor_overwrite_warning.t')
-rw-r--r--t/attributes/accessor_overwrite_warning.t25
1 files changed, 25 insertions, 0 deletions
diff --git a/t/attributes/accessor_overwrite_warning.t b/t/attributes/accessor_overwrite_warning.t
new file mode 100644
index 0000000..aa659f7
--- /dev/null
+++ b/t/attributes/accessor_overwrite_warning.t
@@ -0,0 +1,25 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+use Test::Requires 'Test::Output';
+
+{
+ package Bar;
+ use Moose;
+
+ has has_attr => (
+ is => 'ro',
+ );
+
+ ::stderr_like{ has attr => (
+ is => 'ro',
+ predicate => 'has_attr',
+ )
+ }
+ qr/\QYou are overwriting an accessor (has_attr) for the has_attr attribute with a new accessor method for the attr attribute/,
+ 'overwriting an accessor for another attribute causes a warning';
+}
+
+done_testing;