From: Karen Etheridge Date: Sat, 27 Nov 2010 19:36:34 +0000 (-0800) Subject: convert all uses of Test::Exception to Test::Fatal. X-Git-Tag: 0.27~20 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c1068a210140ebcce00a286dd89624914c3cd8d7;p=gitmo%2FMooseX-Singleton.git convert all uses of Test::Exception to Test::Fatal. --- diff --git a/ChangeLog b/ChangeLog index cc6ac51..986e8cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ Revision history for Perl extension MooseX-Singleton +{{NEXT}} + - The test suite now uses Test::Fatal instead of Test::Exception (Karen + Etheridge). + 0.25 2010-08-22 - Fixes for latest Moose. (Dave Rolsky) diff --git a/Makefile.PL b/Makefile.PL index 3ea4e37..b91f86b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -9,7 +9,7 @@ requires 'Moose' => '1.10'; build_requires 'Scalar::Util'; build_requires 'Test::More' => '0.88'; -build_requires 'Test::Exception'; +build_requires 'Test::Fatal'; build_requires 'Test::Requires'; license 'Perl'; diff --git a/t/002-init.t b/t/002-init.t index bb1a548..ef2f949 100644 --- a/t/002-init.t +++ b/t/002-init.t @@ -1,7 +1,7 @@ use strict; use warnings; use Test::More; -use Test::Exception; +use Test::Fatal; my $i = 0; sub new_singleton_pkg { @@ -16,13 +16,13 @@ sub new_singleton_pkg { return $pkg_name; } -throws_ok { new_singleton_pkg()->instance } +like( exception { new_singleton_pkg()->instance }, qr/\QAttribute (number) is required/, - q{can't get the Singleton if requires attrs and we don't provide them}; + q{can't get the Singleton if requires attrs and we don't provide them}); -throws_ok { new_singleton_pkg()->string } +like( exception { new_singleton_pkg()->string }, qr/\QAttribute (number) is required/, - q{can't call any Singleton attr reader if Singleton can't be inited}; + q{can't call any Singleton attr reader if Singleton can't be inited}); for my $pkg (new_singleton_pkg) { my $mst = $pkg->new( number => 5 ); @@ -36,9 +36,9 @@ for my $pkg (new_singleton_pkg) { "the class method, called directly, returns the given attribute value" ); - throws_ok { $pkg->new( number => 3 ) } + like( exception { $pkg->new( number => 3 ) }, qr/already/, - "can't make new singleton with conflicting attributes"; + "can't make new singleton with conflicting attributes"); my $second = eval { $pkg->new }; ok( !$@, "...but a second ->new without args is okay" ); @@ -46,9 +46,9 @@ for my $pkg (new_singleton_pkg) { is( $second->number, 5, "...we get the originally inited number from it" ); - throws_ok { $pkg->initialize } + like( exception { $pkg->initialize }, qr/already/, - "...but ->initialize() is still an error"; + "...but ->initialize() is still an error"); } { diff --git a/t/006-cooperative.t b/t/006-cooperative.t index fdae12f..56579f1 100644 --- a/t/006-cooperative.t +++ b/t/006-cooperative.t @@ -5,7 +5,7 @@ use Test::More; use Test::Requires { 'MooseX::StrictConstructor' => 0.01, # skip all if not installed - 'Test::Exception' => 0.01, + 'Test::Fatal' => 0.001, }; { @@ -17,9 +17,9 @@ use Test::Requires { has 'attrib' => ( is => 'rw' ); } -throws_ok { +like( exception { MySingleton->new( bad_name => 42 ); -} -qr/Found unknown attribute/, 'singleton class also has a strict constructor'; +}, +qr/Found unknown attribute/, 'singleton class also has a strict constructor'); done_testing;