Add a failing test for combination with MooseX::ClassAttribute
Shawn M Moore [Thu, 30 Oct 2008 00:22:58 +0000 (00:22 +0000)]
MooseX::ClassAttribute depends on MooseX::AttributeHelpers, but I suspect the bug is in this code

t/900_class_attribute.t [new file with mode: 0644]

diff --git a/t/900_class_attribute.t b/t/900_class_attribute.t
new file mode 100644 (file)
index 0000000..bb59dc3
--- /dev/null
@@ -0,0 +1,28 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 2;
+
+do {
+    package TestClass;
+    BEGIN {
+        ::plan skip_all => "MooseX::ClassAttribute required for this test"
+            unless eval {
+                require MooseX::ClassAttribute;
+                MooseX::ClassAttribute->VERSION('0.05');
+            };
+        MooseX::ClassAttribute->import;
+    }
+
+    class_has counter => (
+        metaclass => 'Counter',
+        provides  => {
+            inc => 'inc_counter',
+        },
+    );
+};
+
+is(TestClass->counter, 0);
+TestClass->inc_counter;
+is(TestClass->counter, 1);
+