'Declare::Constraints::Simple' => '0.01', # skip all if not installed
};
-use Test::Fatal;
+use Test::Exception;
{
package Foo;
my $array_of_ints = [ 1 .. 10 ];
my $foo;
-ok ! exception {
+lives_ok {
$foo = Foo->new(
'bar' => $hash_of_arrays_of_objs,
'baz' => $array_of_ints,
);
-}, '... construction succeeded';
+} '... construction succeeded';
isa_ok($foo, 'Foo');
is_deeply($foo->bar, $hash_of_arrays_of_objs, '... got our value correctly');
is_deeply($foo->baz, $array_of_ints, '... got our value correctly');
-ok exception {
+dies_ok {
$foo->bar([]);
-}, '... validation failed correctly';
+} '... validation failed correctly';
-ok exception {
+dies_ok {
$foo->bar({ foo => 3 });
-}, '... validation failed correctly';
+} '... validation failed correctly';
-ok exception {
+dies_ok {
$foo->bar({ foo => [ 1, 2, 3 ] });
-}, '... validation failed correctly';
+} '... validation failed correctly';
-ok exception {
+dies_ok {
$foo->baz([ "foo" ]);
-}, '... validation failed correctly';
+} '... validation failed correctly';
-ok exception {
+dies_ok {
$foo->baz({});
-}, '... validation failed correctly';
+} '... validation failed correctly';
done_testing;