# Old:
cmp_deeply($obj->method, [ $result1, $result2 ]);
# New:
cmp_deeply($obj->method, bag($result1, $result2));
####
use warnings;
use strict;
{ package Person;
use Moose;
use namespace::autoclean;
has name => ( is => 'rw',
isa => 'Str',
required => 1,
);
has id => ( is => 'ro',
isa => 'Str',
required => 1,
);
__PACKAGE__->meta->make_immutable;
}
{ package Position;
use Moose;
use namespace::autoclean;
has person => ( is => 'rw',
isa => 'Person',
);
has title => ( is => 'ro',
isa => 'Str',
);
__PACKAGE__->meta->make_immutable;
}
##
##
use Test::Spec;
describe 'position' => sub {
it 'instantiates' => sub {
my $person = stub();
my $position = 'Position'->new(person => $person);
isa_ok($position, 'Position');
cmp_deeply([ $position->person ], bag($person));
};
};
##
##
Attribute (person) does not pass the type constraint because: Validation failed for 'Person' with value Test::Spec::Mocks::MockObject={ }
##
##
my $person = stub( isa => 1 );
##
##
Found a special comparison in $data
You can only use specials in the expects structure at /home/choroba/perl5/lib/perl5/Test/Deep.pm line 346.
##
##
# Old:
if (! $Expects and ref($d1) and UNIVERSAL::isa($d1, "Test::Deep::Cmp"))
# New:
if (! $Expects and Scalar::Util::blessed($d1) and $d1->isa("Test::Deep::Cmp"))
##
##
my $person = stub( isa => sub { $_[1] !~ /Test/ } );
##
##
sub mock_isa { my ($class) = @_; isa => sub { $_[1] eq $class } }
##
##
my $person = stub(mock_isa('Person'));
##
##
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord
}map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,