Make MX::AH optional
Dave Rolsky [Wed, 20 Jan 2010 21:48:01 +0000 (15:48 -0600)]
t/05-with-attribute-helpers-backcompat.t [new file with mode: 0644]

diff --git a/t/05-with-attribute-helpers-backcompat.t b/t/05-with-attribute-helpers-backcompat.t
new file mode 100644 (file)
index 0000000..9d757f6
--- /dev/null
@@ -0,0 +1,31 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+BEGIN {
+    eval "use MooseX::AttributeHelpers 0.13;";
+    plan skip_all => 'This test requires MooseX::AttributeHelpers 0.13+'
+        if $@;
+}
+
+{
+    package MyClass;
+
+    use MooseX::ClassAttribute;
+    use MooseX::AttributeHelpers;
+
+    class_has counter =>
+        ( metaclass => 'Counter',
+          is        => 'ro',
+          provides  => { inc => 'inc_counter',
+                       },
+        );
+}
+
+is( MyClass->counter(), 0 );
+
+MyClass->inc_counter();
+is( MyClass->counter(), 1 );
+
+done_testing();