From: Karen Etheridge Date: Sun, 25 Mar 2012 00:19:37 +0000 (-0700) Subject: rename these tests to "basic", and test both mutable and immutable paths X-Git-Tag: 0.13~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cd954cc2a4b795e53b32d85d2a08873684fada94;p=gitmo%2FMooseX-UndefTolerant.git rename these tests to "basic", and test both mutable and immutable paths --- diff --git a/t/basic.t b/t/basic.t new file mode 100644 index 0000000..17c4e17 --- /dev/null +++ b/t/basic.t @@ -0,0 +1,38 @@ +use Test::More; +use Test::Moose; + +{ +package Foo; +use Moose; +use MooseX::UndefTolerant; + +has 'bar' => ( + is => 'ro', + isa => 'Num', + predicate => 'has_bar' +); + +__PACKAGE__->meta->make_immutable; +} + +package main; + +with_immutable { + { + my $foo = Foo->new; + ok(!$foo->has_bar); + } + + { + my $foo = Foo->new(bar => undef); + ok(!$foo->has_bar); + } + + { + my $foo = Foo->new(bar => 1234); + cmp_ok($foo->bar, 'eq', 1234); + ok($foo->has_bar); + } +} 'Foo'; + +done_testing; diff --git a/t/immutable.t b/t/immutable.t deleted file mode 100644 index 6a15655..0000000 --- a/t/immutable.t +++ /dev/null @@ -1,33 +0,0 @@ -use Test::More; - -package Foo; -use Moose; -use MooseX::UndefTolerant; - -has 'bar' => ( - is => 'ro', - isa => 'Num', - predicate => 'has_bar' -); - -__PACKAGE__->meta->make_immutable; - -package main; - -{ - my $foo = Foo->new; - ok(!$foo->has_bar); -} - -{ - my $foo = Foo->new(bar => undef); - ok(!$foo->has_bar); -} - -{ - my $foo = Foo->new(bar => 1234); - cmp_ok($foo->bar, 'eq', 1234); - ok($foo->has_bar); -} - -done_testing;