-#!/usr/bin/perl
-
use strict;
use warnings;
use Test::More tests => 18;
-use Test::Exception;
+use Test::Deep;
+use Test::Fatal;
BEGIN {
use_ok('MooseX::Storage');
$circular->cycle($circular);
- throws_ok {
+ like(exception {
$circular->pack;
- } qr/^Basic Engine does not support cycles/,
- '... cannot collapse a cycle with the basic engine';
+ }, qr/^Basic Engine does not support cycles/,
+ '... cannot collapse a cycle with the basic engine');
}
{
my $packed_circular = { __CLASS__ => 'Circular' };
$packed_circular->{cycle} = $packed_circular;
- throws_ok {
+ like( exception {
Circular->unpack($packed_circular);
- } qr/^Basic Engine does not support cycles/,
- '... cannot expand a cycle with the basic engine';
+ }, qr/^Basic Engine does not support cycles/,
+ '... cannot expand a cycle with the basic engine');
}
{
my $t = Tree->new(node => 100);
isa_ok($t, 'Tree');
- is_deeply(
+ cmp_deeply(
$t->pack,
{
__CLASS__ => 'Tree',
$t->add_child($t2);
- is_deeply($t->children, [ $t2 ], '... got the right children in $t');
+ cmp_deeply($t->children, [ $t2 ], '... got the right children in $t');
is($t2->parent, $t, '... created the cycle correctly');
isa_ok($t2->parent, 'Tree');
- is_deeply(
+ cmp_deeply(
$t->pack,
{
__CLASS__ => 'Tree',
},
'... got the right packed version (with parent attribute skipped in child)');
- is_deeply(
+ cmp_deeply(
$t2->pack,
{
__CLASS__ => 'Tree',