use warnings;
use Test::More;
-use Test::Fatal;
+use Test::Exception;
BEGIN {
use_ok('Moose::Util::TypeConstraints');
# test parameterizable
-ok ! exception {
+lives_ok sub {
$params->parameterizable( { a => 'Hello', b => 'World' } );
-}, => 'No problem setting parameterizable';
+} => 'No problem setting parameterizable';
is_deeply $params->parameterizable,
{ a => 'Hello', b => 'World' } => 'Got expected values';
# test parameterized
-ok ! exception {
+lives_ok sub {
$params->parameterized( { a => 1, b => 2 } );
-}, => 'No problem setting parameterized';
+} => 'No problem setting parameterized';
is_deeply $params->parameterized, { a => 1, b => 2 } => 'Got expected values';
-like exception {
+throws_ok sub {
$params->parameterized( { a => 'Hello', b => 'World' } );
- },, qr/Attribute \(parameterized\) does not pass the type constraint/ =>
+ }, qr/Attribute \(parameterized\) does not pass the type constraint/ =>
'parameterized throws expected error';
# test from_parameterizable
-ok ! exception {
+lives_ok sub {
$params->from_parameterizable( { a => 1, b => 2 } );
-}, => 'No problem setting from_parameterizable';
+} => 'No problem setting from_parameterizable';
is_deeply $params->from_parameterizable,
{ a => 1, b => 2 } => 'Got expected values';
-like exception {
+throws_ok sub {
$params->from_parameterizable( { a => 'Hello', b => 'World' } );
- },,
+ },
qr/Attribute \(from_parameterizable\) does not pass the type constraint/
=> 'from_parameterizable throws expected error';