summary refs log tree commit diff
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-06-19 15:08:09 +0200
committerfranck cuny <franck@lumberjaph.net>2010-06-19 15:08:09 +0200
commiteacda40831fc234b63dac829abf749d438bef75a (patch)
tree29d15cde8954a57ce2c41bf1f08fef8b7abb305a
parentChecking in changes prior to tagging of version 0.01. Changelog diff is: (diff)
downloadmoosex-privacy-eacda40831fc234b63dac829abf749d438bef75a.tar.gz
add test for RT#58330
-rw-r--r--t/90_bug.t44
1 files changed, 44 insertions, 0 deletions
diff --git a/t/90_bug.t b/t/90_bug.t
new file mode 100644
index 0000000..45228cc
--- /dev/null
+++ b/t/90_bug.t
@@ -0,0 +1,44 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Exception;
+
+package Foo;
+use Moose;
+use MooseX::Privacy;
+
+has foo => (
+    is        => 'rw',
+    isa       => 'Str',
+    predicate => 'has_foo',
+    clearer   => '_clear_foo',
+    lazy      => 1,
+    default   => 'BooM!',
+    traits    => [qw/Private/],
+);
+
+has bar => (
+    is     => 'ro',
+    isa    => 'Str',
+    traits => [qw/Private/],
+);
+
+sub public_foo { shift->foo }
+sub public_foo_clearer { shift->_clear_foo }
+sub public_foo_predicate { shift->has_foo ? return 1 : return 0 }
+
+package main;
+
+my $o = Foo->new();
+dies_ok { $o->foo };
+dies_ok { $o->bar };
+dies_ok { $o->has_foo };
+dies_ok { $o->_clear_foo };
+
+is $o->public_foo, 'BooM!';
+ok $o->public_foo_predicate;
+ok $o->public_foo_clearer;
+ok !$o->public_foo_predicate;
+
+done_testing;