From: gfx Date: Wed, 16 Dec 2009 08:51:49 +0000 (+0900) Subject: Add tests for get_value etc X-Git-Tag: 0.45~20 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=commitdiff_plain;h=db6e462c5abe5f680851ab11c4d3cab3386595cf Add tests for get_value etc --- diff --git a/t/001_mouse/065-attr-mop.t b/t/001_mouse/065-attr-mop.t new file mode 100644 index 0000000..909d317 --- /dev/null +++ b/t/001_mouse/065-attr-mop.t @@ -0,0 +1,32 @@ +#!perl +use strict; +use warnings; +use Test::More tests => 10; +use Test::Mouse; + +{ + package MyClass; + use Mouse; + + has 'foo' => ( + is => 'bare', + ); +} + +with_immutable { + my $obj = MyClass->new(); + my $foo = $obj->meta->get_attribute('foo'); + ok $foo, $obj->meta->is_immutable ? 'immutable' : 'mutable'; + + ok !$foo->has_value($obj), 'has_value'; + + $foo->set_value($obj, 'bar'); + is $foo->get_value($obj), 'bar', 'set_value/get_value'; + + ok $foo->has_value($obj), 'has_value'; + + $foo->clear_value($obj); + + ok!$foo->has_value($obj), 'clear_value'; + +} qw(MyClass);