summaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2010-11-08 21:59:58 -0600
committerJesse Luehrs <doy@tozt.net>2010-11-08 21:59:58 -0600
commit9521ec78c2fa5aeba53578f0bc94300d0abc8f8a (patch)
tree59d0bcf4e41d533f1f585702436b61d7020320b8 /t
parent36fb7f594d2e8249ca656725922e3118e6458153 (diff)
downloadmoosex-nonmoose-9521ec78c2fa5aeba53578f0bc94300d0abc8f8a.tar.gz
moosex-nonmoose-9521ec78c2fa5aeba53578f0bc94300d0abc8f8a.zip
convert to Test::Fatal, and actually dep on it
Diffstat (limited to 't')
-rw-r--r--t/51-buggy-constructors.t26
-rw-r--r--t/52-hashref-constructor.t10
-rw-r--r--t/60-extends-version.t6
3 files changed, 19 insertions, 23 deletions
diff --git a/t/51-buggy-constructors.t b/t/51-buggy-constructors.t
index 066498d..bbe5127 100644
--- a/t/51-buggy-constructors.t
+++ b/t/51-buggy-constructors.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use Test::More;
-use Test::Exception;
+use Test::Fatal;
use Test::Moose;
{
@@ -21,9 +21,8 @@ use Test::Moose;
with_immutable {
my $foo;
- lives_ok {
- $foo = Foo::Sub->new;
- } "subclassing nonmoose classes with correct constructors works";
+ is(exception { $foo = Foo::Sub->new }, undef,
+ "subclassing nonmoose classes with correct constructors works");
isa_ok($foo, 'Foo');
isa_ok($foo, 'Foo::Sub');
} 'Foo::Sub';
@@ -44,9 +43,8 @@ with_immutable {
with_immutable {
my $foo;
- lives_ok {
- $foo = BadFoo::Sub->new;
- } "subclassing nonmoose classes with incorrect constructors works";
+ is(exception { $foo = BadFoo::Sub->new }, undef,
+ "subclassing nonmoose classes with incorrect constructors works");
isa_ok($foo, 'BadFoo');
isa_ok($foo, 'BadFoo::Sub');
} 'BadFoo::Sub';
@@ -67,10 +65,9 @@ with_immutable {
with_immutable {
my $foo;
- throws_ok {
- $foo = BadFoo2::Sub->new;
- } qr/\QThe constructor for BadFoo2 did not return a blessed instance/,
- "subclassing nonmoose classes with incorrect constructors dies properly";
+ like(exception { $foo = BadFoo2::Sub->new; },
+ qr/\QThe constructor for BadFoo2 did not return a blessed instance/,
+ "subclassing nonmoose classes with incorrect constructors dies properly");
} 'BadFoo2::Sub';
{
@@ -89,10 +86,9 @@ with_immutable {
with_immutable {
my $foo;
- throws_ok {
- $foo = BadFoo3::Sub->new;
- } qr/\QThe constructor for BadFoo3 returned an object whose class is not a parent of BadFoo3::Sub/,
- "subclassing nonmoose classes with incorrect constructors dies properly";
+ like(exception { $foo = BadFoo3::Sub->new },
+ qr/\QThe constructor for BadFoo3 returned an object whose class is not a parent of BadFoo3::Sub/,
+ "subclassing nonmoose classes with incorrect constructors dies properly");
} 'BadFoo3::Sub';
done_testing;
diff --git a/t/52-hashref-constructor.t b/t/52-hashref-constructor.t
index 74fd530..00deff0 100644
--- a/t/52-hashref-constructor.t
+++ b/t/52-hashref-constructor.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use Test::More;
-use Test::Exception;
+use Test::Fatal;
{
package Foo;
@@ -47,8 +47,8 @@ use Test::Exception;
{
my $baz;
- lives_ok { $baz = Baz->new( foo => 1, bar => 2, baz => 3 ) }
- "constructor lives";
+ is(exception { $baz = Baz->new( foo => 1, bar => 2, baz => 3 ) }, undef,
+ "constructor lives");
is($baz->foo, 1, "foo set");
is($baz->bar, 2, "bar set");
is($baz->baz, 3, "baz set");
@@ -57,8 +57,8 @@ use Test::Exception;
{
my $baz;
- lives_ok { $baz = Baz->new({foo => 1, bar => 2, baz => 3}) }
- "constructor lives (hashref)";
+ is(exception { $baz = Baz->new({foo => 1, bar => 2, baz => 3}) }, undef,
+ "constructor lives (hashref)");
is($baz->foo, 1, "foo set (hashref)");
is($baz->bar, 2, "bar set (hashref)");
is($baz->baz, 3, "baz set (hashref)");
diff --git a/t/60-extends-version.t b/t/60-extends-version.t
index 7f1f97f..4f607b8 100644
--- a/t/60-extends-version.t
+++ b/t/60-extends-version.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use Test::More;
-use Test::Exception;
+use Test::Fatal;
{
package Foo;
@@ -14,8 +14,8 @@ use Test::Exception;
package Bar;
use Moose;
use MooseX::NonMoose;
- ::lives_ok { extends 'Foo' => { -version => '0.02' } }
- "specifying arguments to superclasses doesn't break";
+ ::is(::exception { extends 'Foo' => { -version => '0.02' } }, undef,
+ "specifying arguments to superclasses doesn't break");
}
done_testing;