Begin adding tests for has +foo
Shawn M Moore [Sun, 15 Jun 2008 18:34:46 +0000 (18:34 +0000)]
t/030-has-plus.t [new file with mode: 0644]

diff --git a/t/030-has-plus.t b/t/030-has-plus.t
new file mode 100644 (file)
index 0000000..7706f4a
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+do {
+    package Class;
+    use Mouse;
+
+    has attr => (
+        is  => 'rw',
+        isa => 'Bool',
+    );
+
+    package Child;
+    use Mouse;
+    extends 'Class';
+
+    has '+attr' => (
+        default => 1,
+    );
+};
+
+my $obj = Class->new;
+ok(!$obj->attr, 'has + does not affect the superclass');
+
+my $obj2 = Child->new;
+ok($obj2->attr, 'has + combines child attribute with parent');
+