X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F072_immutable_w_constructors.t;h=02613b3352773df080e85ca383a09b89adaaa8c9;hb=d65739b4429cbd77a5400b2ac8273af504fcf3da;hp=7ef79f097810a669547b4e3050c8e11b28aa1754;hpb=d69fb6b34cf37d63bbed4d941ad809539299e218;p=gitmo%2FClass-MOP.git diff --git a/t/072_immutable_w_constructors.t b/t/072_immutable_w_constructors.t index 7ef79f0..02613b3 100644 --- a/t/072_immutable_w_constructors.t +++ b/t/072_immutable_w_constructors.t @@ -1,11 +1,11 @@ use strict; use warnings; -use Test::More tests => 91; -use Test::Exception; +use Test::More; +use Test::Fatal; + +use Class::MOP; -BEGIN {use Class::MOP;use Class::MOP::Immutable; -} { package Foo; @@ -81,12 +81,12 @@ BEGIN {use Class::MOP;use Class::MOP::Immutable; ok(!$meta->is_immutable, '... our class is not immutable'); - lives_ok { + ok ! exception { $meta->make_immutable( inline_constructor => 1, inline_accessors => 0, ); - } '... changed Foo to be immutable'; + }, '... changed Foo to be immutable'; ok($meta->is_immutable, '... our class is now immutable'); isa_ok($meta, 'Class::MOP::Class'); @@ -146,12 +146,12 @@ BEGIN {use Class::MOP;use Class::MOP::Immutable; ok(!$meta->is_immutable, '... our class is not immutable'); - lives_ok { + ok ! exception { $meta->make_immutable( inline_constructor => 1, inline_accessors => 1, ); - } '... changed Bar to be immutable'; + }, '... changed Bar to be immutable'; ok($meta->is_immutable, '... our class is now immutable'); isa_ok($meta, 'Class::MOP::Class'); @@ -215,12 +215,12 @@ BEGIN {use Class::MOP;use Class::MOP::Immutable; ok(!$meta->is_immutable, '... our class is not immutable'); - lives_ok { + ok ! exception { $meta->make_immutable( inline_constructor => 0, inline_accessors => 1, ); - } '... changed Bar to be immutable'; + }, '... changed Bar to be immutable'; ok($meta->is_immutable, '... our class is now immutable'); isa_ok($meta, 'Class::MOP::Class'); @@ -267,7 +267,7 @@ BEGIN {use Class::MOP;use Class::MOP::Immutable; { my $buzz; - ::lives_ok { $buzz = Buzz->meta->new_object } '...Buzz instantiated successfully'; + ::ok ! ::exception { $buzz = Buzz->meta->new_object }, '...Buzz instantiated successfully'; ::ok(!$buzz->has_bar, '...bar is not set'); ::is($buzz->bar, undef, '...bar returns undef'); ::ok(!$buzz->has_bar, '...bar was not autovivified'); @@ -279,7 +279,7 @@ BEGIN {use Class::MOP;use Class::MOP::Immutable; ::ok(!$buzz->has_bar, '...bar is no longerset'); my $buzz2; - ::lives_ok { $buzz2 = Buzz->meta->new_object('bar' => undef) } '...Buzz instantiated successfully'; + ::ok ! ::exception { $buzz2 = Buzz->meta->new_object('bar' => undef) }, '...Buzz instantiated successfully'; ::ok($buzz2->has_bar, '...bar is set'); ::is($buzz2->bar, undef, '...bar is undef'); @@ -287,13 +287,15 @@ BEGIN {use Class::MOP;use Class::MOP::Immutable; { my $buzz; - ::lives_ok { $buzz = Buzz->meta->new_object } '...Buzz instantiated successfully'; + ::ok ! ::exception { $buzz = Buzz->meta->new_object }, '...Buzz instantiated successfully'; ::ok($buzz->has_bah, '...bah is set'); ::is($buzz->bah, 'BAH', '...bah returns "BAH"' ); my $buzz2; - ::lives_ok { $buzz2 = Buzz->meta->new_object('bah' => undef) } '...Buzz instantiated successfully'; + ::ok ! ::exception { $buzz2 = Buzz->meta->new_object('bah' => undef) }, '...Buzz instantiated successfully'; ::ok($buzz2->has_bah, '...bah is set'); ::is($buzz2->bah, undef, '...bah is undef'); } + +done_testing;