Upgrade to Test::Simple 0.53
[p5sagit/p5-mst-13.2.git] / lib / Test / Simple / t / circular_data.t
1 #!/usr/bin/perl -w
2
3 # Test is_deeply and friends with circular data structures [rt.cpan.org 7289]
4
5 BEGIN {
6     if( $ENV{PERL_CORE} ) {
7         chdir 't';
8         @INC = ('../lib', 'lib');
9     }
10     else {
11         unshift @INC, 't/lib';
12     }
13 }
14
15 use strict;
16 use Test::More tests => 5;
17
18 my $a1 = [ 1, 2, 3 ];
19 push @$a1, $a1;
20 my $a2 = [ 1, 2, 3 ];
21 push @$a2, $a2;
22
23 is_deeply $a1, $a2;
24 ok( eq_array ($a1, $a2) );
25 ok( eq_set   ($a1, $a2) );
26
27 my $h1 = { 1=>1, 2=>2, 3=>3 };
28 $h1->{4} = $h1;
29 my $h2 = { 1=>1, 2=>2, 3=>3 };
30 $h2->{4} = $h2;
31
32 is_deeply $h1, $h2;
33 ok( eq_hash  ($h1, $h2) );