use Test::Fatal instead of Test::Exception
Justin Hunter [Tue, 6 Dec 2011 03:33:05 +0000 (22:33 -0500)]
Makefile.PL
t/01-string.t
t/02-numeric.t

index 10cd1d8..9edc336 100644 (file)
@@ -12,7 +12,7 @@ requires 'MooseX::Types' => '0.04';
 
 # things the tests need
 test_requires 'Test::More' => '0.62';
-test_requires 'Test::Exception';
+test_requires 'Test::Fatal';
 
 resources 'IRC' => 'irc://irc.perl.org/#moose';
 resources 'license' => 'http://dev.perl.org/licenses/';
index 7632b70..083f783 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More tests => 14;
-use Test::Exception;
+use Test::Fatal;
 
 {
   package FooTest;
@@ -21,21 +21,21 @@ use Test::Exception;
 
 my $ins = FooTest->new;
 
-lives_ok { $ins->simplestr('') } 'SimpleStr';
-lives_ok { $ins->simplestr('good string') } 'SimpleStr 2';
-dies_ok { $ins->simplestr("bad\nstring") } 'SimpleStr 3';
-dies_ok { $ins->simplestr(join('', ("long string" x 25))) } 'SimpleStr 4';
+is(exception { $ins->simplestr('') }, undef, 'SimpleStr');
+is(exception { $ins->simplestr('good string') }, undef, 'SimpleStr 2');
+isnt(exception { $ins->simplestr("bad\nstring") }, 'SimpleStr 3');
+isnt(exception { $ins->simplestr(join('', ("long string" x 25))) }, undef, 'SimpleStr 4');
 
-dies_ok { $ins->nestr('') } 'NonEmptyStr';
-lives_ok { $ins->nestr('good string') } 'NonEmptyStr 2';
-lives_ok { $ins->nestr("bad\nstring") } 'NonEmptyStr 3';
-lives_ok { $ins->nestr(join('', ("long string" x 25))) } 'NonEmptyStr 4';
+isnt(exception { $ins->nestr('') }, undef, 'NonEmptyStr');
+is(exception { $ins->nestr('good string') }, undef, 'NonEmptyStr 2');
+is(exception { $ins->nestr("bad\nstring") }, undef, 'NonEmptyStr 3');
+is(exception { $ins->nestr(join('', ("long string" x 25))) }, undef, 'NonEmptyStr 4');
 
-lives_ok { $ins->nesimplestr('good str') } 'NonEmptySimplrStr ';
-dies_ok { $ins->nesimplestr('') } 'NonEmptyStr 2';
+is(exception { $ins->nesimplestr('good str') }, undef, 'NonEmptySimplrStr');
+isnt(exception { $ins->nesimplestr('') }, undef, 'NonEmptyStr 2');
 
-dies_ok { $ins->password('no') } 'Password';
-lives_ok { $ins->password('okay') } 'Password 2';
+isnt(exception { $ins->password('no') }, undef, 'Password');
+is(exception { $ins->password('okay') }, undef, 'Password 2');
 
-dies_ok { $ins->strongpassword('notokay') } 'StrongPassword';
-lives_ok { $ins->strongpassword('83773r_ch01c3') } 'StrongPassword 2';
+isnt(exception { $ins->strongpassword('notokay') }, undef, 'StrongPassword');
+is(exception { $ins->strongpassword('83773r_ch01c3') }, undef, 'StrongPassword 2');
index 4908d04..5aaf730 100644 (file)
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 use Test::More tests => 34;
-use Test::Exception;
+use Test::Fatal;
 
 {
   package FooTest;
@@ -29,41 +29,41 @@ use Test::Exception;
 
 my $ins = FooTest->new;
 
-dies_ok { $ins->digit(100); } 'SingleDigit';
-lives_ok { $ins->digit(1); } 'SingleDigit 2';
+isnt(exception { $ins->digit(100); }, undef, 'SingleDigit');
+is(exception { $ins->digit(1); }, undef, 'SingleDigit 2');
 
-dies_ok { $ins->posint(-100); } 'PositiveInt (-100)';
-dies_ok { $ins->posint(0); } 'PositiveInt (0)';
-dies_ok { $ins->posint(100.885); } 'PositiveInt (100.885)';
-lives_ok { $ins->posint(100); } 'PositiveInt (100)';
-dies_ok { $ins->posnum(0); } 'PositiveNum (0)';
-lives_ok { $ins->posnum(100.885); } 'PositiveNum (100.885)';
-dies_ok { $ins->posnum(-100.885); } 'PositiveNum (-100.885)';
-lives_ok { $ins->posnum(0.0000000001); } 'PositiveNum (0.0000000001)';
+isnt(exception { $ins->posint(-100); }, undef, 'PositiveInt (-100)');
+isnt(exception { $ins->posint(0); }, undef, 'PositiveInt (0)');
+isnt(exception { $ins->posint(100.885); }, undef, 'PositiveInt (100.885)');
+is(exception { $ins->posint(100); }, undef, 'PositiveInt (100)');
+isnt(exception { $ins->posnum(0); }, undef, 'PositiveNum (0)');
+is(exception { $ins->posnum(100.885); }, undef, 'PositiveNum (100.885)');
+isnt(exception { $ins->posnum(-100.885); }, undef, 'PositiveNum (-100.885)');
+is(exception { $ins->posnum(0.0000000001); }, undef, 'PositiveNum (0.0000000001)');
 
-dies_ok { $ins->posorzeroint(-100); } 'PositiveOrZeroInt (-100)';
-lives_ok { $ins->posorzeroint(0); } 'PositiveOrZeroInt (0)';
-dies_ok { $ins->posorzeroint(100.885); } 'PositiveOrZeroInt (100.885)';
-lives_ok { $ins->posorzeroint(100); } 'PositiveOrZeroInt (100)';
-lives_ok { $ins->posorzeronum(0); } 'PositiveOrZeroNum (0)';
-lives_ok { $ins->posorzeronum(100.885); } 'PositiveOrZeroNum (100.885)';
-dies_ok { $ins->posorzeronum(-100.885); } 'PositiveOrZeroNum (-100.885)';
-lives_ok { $ins->posorzeronum(0.0000000001); } 'PositiveOrZeroNum (0.0000000001)';
+isnt(exception { $ins->posorzeroint(-100); }, undef, 'PositiveOrZeroInt (-100)');
+is(exception { $ins->posorzeroint(0); }, undef, 'PositiveOrZeroInt (0)');
+isnt(exception { $ins->posorzeroint(100.885); }, undef, 'PositiveOrZeroInt (100.885)');
+is(exception { $ins->posorzeroint(100); }, undef, 'PositiveOrZeroInt (100)');
+is(exception { $ins->posorzeronum(0); }, undef, 'PositiveOrZeroNum (0)');
+is(exception { $ins->posorzeronum(100.885); }, undef, 'PositiveOrZeroNum (100.885)');
+isnt(exception { $ins->posorzeronum(-100.885); }, undef, 'PositiveOrZeroNum (-100.885)');
+is(exception { $ins->posorzeronum(0.0000000001); }, undef, 'PositiveOrZeroNum (0.0000000001)');
 
-dies_ok { $ins->negint(100); } 'NegativeInt (100)';
-dies_ok { $ins->negint(-100.885); } 'NegativeInt (-100.885)';
-lives_ok { $ins->negint(-100); } 'NegativeInt (-100)';
-dies_ok { $ins->negint(0); } 'NegativeInt (0)';
-lives_ok { $ins->negnum(-100.885); } 'NegativeNum (-100.885)';
-dies_ok { $ins->negnum(100.885); } 'NegativeNum (100.885)';
-dies_ok { $ins->negnum(0); } 'NegativeNum (0)';
-lives_ok { $ins->negnum(-0.0000000001); } 'NegativeNum (-0.0000000001)';
+isnt(exception { $ins->negint(100); }, undef, 'NegativeInt (100)');
+isnt(exception { $ins->negint(-100.885); }, undef, 'NegativeInt (-100.885)');
+is(exception { $ins->negint(-100); }, undef, 'NegativeInt (-100)');
+isnt(exception { $ins->negint(0); }, undef, 'NegativeInt (0)');
+is(exception { $ins->negnum(-100.885); }, undef, 'NegativeNum (-100.885)');
+isnt(exception { $ins->negnum(100.885); }, undef, 'NegativeNum (100.885)');
+isnt(exception { $ins->negnum(0); }, undef, 'NegativeNum (0)');
+is(exception { $ins->negnum(-0.0000000001); }, undef, 'NegativeNum (-0.0000000001)');
 
-dies_ok { $ins->negorzeroint(100); } 'NegativeOrZeroInt (100)';
-dies_ok { $ins->negorzeroint(-100.885); } 'NegativeOrZeroInt (-100.885)';
-lives_ok { $ins->negorzeroint(-100); } 'NegativeOrZeroInt (-100)';
-lives_ok { $ins->negorzeroint(0); } 'NegativeOrZeroInt (0)';
-lives_ok { $ins->negorzeronum(-100.885); } 'NegativeOrZeroNum (-100.885)';
-dies_ok { $ins->negorzeronum(100.885); } 'NegativeOrZeroNum (100.885)';
-lives_ok { $ins->negorzeronum(0); } 'NegativeOrZeroNum (0)';
-lives_ok { $ins->negorzeronum(-0.0000000001); } 'NegativeOrZeroNum (-0.0000000001)';
+isnt(exception { $ins->negorzeroint(100); }, undef, 'NegativeOrZeroInt (100)');
+isnt(exception { $ins->negorzeroint(-100.885); }, undef, 'NegativeOrZeroInt (-100.885)');
+is(exception { $ins->negorzeroint(-100); }, undef, 'NegativeOrZeroInt (-100)');
+is(exception { $ins->negorzeroint(0); }, undef, 'NegativeOrZeroInt (0)');
+is(exception { $ins->negorzeronum(-100.885); }, undef, 'NegativeOrZeroNum (-100.885)');
+isnt(exception { $ins->negorzeronum(100.885); }, undef, 'NegativeOrZeroNum (100.885)');
+is(exception { $ins->negorzeronum(0); }, undef, 'NegativeOrZeroNum (0)');
+is(exception { $ins->negorzeronum(-0.0000000001); }, undef, 'NegativeOrZeroNum (-0.0000000001)');