diff options
author | Fergal Daly <fergal@esatclear.ie> | 2003-03-21 10:57:31 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2003-08-04 05:00:04 +0000 |
commit | 582cb20e4de9cf2d47abf705ff2908664756c5f0 (patch) | |
tree | e42307155d3fe6a72d0d1cdd8594a5774c521094 /lib/Test/Simple | |
parent | 64964e6db0c4795cc54eb4a384a3552aad1ae32d (diff) | |
download | perl-582cb20e4de9cf2d47abf705ff2908664756c5f0.tar.gz |
4 bugs in Test::More
Message-Id: <200303211057.31879.fergal@esatclear.ie>
p4raw-id: //depot/perl@20465
Diffstat (limited to 'lib/Test/Simple')
-rw-r--r-- | lib/Test/Simple/t/More.t | 5 | ||||
-rw-r--r-- | lib/Test/Simple/t/is_deeply.t | 40 |
2 files changed, 40 insertions, 5 deletions
diff --git a/lib/Test/Simple/t/More.t b/lib/Test/Simple/t/More.t index df8c5fea17..abd1e8098f 100644 --- a/lib/Test/Simple/t/More.t +++ b/lib/Test/Simple/t/More.t @@ -7,7 +7,7 @@ BEGIN { } } -use Test::More tests => 41; +use Test::More tests => 42; # Make sure we don't mess with $@ or $!. Test at bottom. my $Err = "this should not be touched"; @@ -69,6 +69,9 @@ ok( eq_hash({ foo => 42, bar => 23 }, {bar => 23, foo => 42}), ok( eq_set([qw(this that whatever)], [qw(that whatever this)]), 'eq_set with simple sets' ); +eq_array([[]], [{}]); +is(scalar @Test::More::Data_Stack, 0, "data stack empty"); + my @complex_array1 = ( [qw(this that whatever)], {foo => 23, bar => 42}, diff --git a/lib/Test/Simple/t/is_deeply.t b/lib/Test/Simple/t/is_deeply.t index 5291fb82c2..a7fbcd039d 100644 --- a/lib/Test/Simple/t/is_deeply.t +++ b/lib/Test/Simple/t/is_deeply.t @@ -92,8 +92,8 @@ is( $out, "not ok 2 - different types\n", 'different types' ); like( $err, <<ERR, ' right diagnostic' ); # Failed test \\($Filename at line 78\\) # Structures begin differing at: -# \\\$got = 'HASH\\(0x[0-9a-f]+\\)' -# \\\$expected = 'ARRAY\\(0x[0-9a-f]+\\)' +# \\\$got = HASH\\(0x[0-9a-f]+\\) +# \\\$expected = ARRAY\\(0x[0-9a-f]+\\) ERR #line 88 @@ -166,8 +166,8 @@ is( $out, "not ok 9 - mixed scalar and array refs\n", like( $err, <<ERR, ' right diagnostic' ); # Failed test \\($Filename at line 151\\) # Structures begin differing at: -# \\\$got = 'ARRAY\\(0x[0-9a-f]+\\)' -# \\\$expected = 'SCALAR\\(0x[0-9a-f]+\\)' +# \\\$got = ARRAY\\(0x[0-9a-f]+\\) +# \\\$expected = SCALAR\\(0x[0-9a-f]+\\) ERR @@ -213,3 +213,35 @@ is( $err, <<ERR, ' right diagnostic' ); # \$got->{that}{foo} = Does not exist # \$expected->{that}{foo} = '42' ERR + +#line 217 +is_deeply([(\"a"), "b"], [(\"a"), "c"], "scalar refs diag"); +is( $out, "not ok 12 - scalar refs diag\n", 'scalar refs diag' ); +is( $err, <<ERR, ' right diagnostic' ); +# Failed test ($0 at line 217) +# Structures begin differing at: +# \$got->[1] = 'b' +# \$expected->[1] = 'c' +ERR + +#line 228 +my $a = []; +is_deeply($a, $a."", "mixed ref and stringified ref"); +is( $out, "not ok 13 - mixed ref and stringified ref\n", 'mixed ref and stringified ref' ); +is( $err, <<ERR, ' right diagnostic' ); +# Failed test ($0 at line 229) +# Structures begin differing at: +# \$got = $a +# \$expected = '$a' +ERR + +#line 238 +my $b = []; +is_deeply({}, {key => $b}, "Does Not Exist"); +is( $out, "not ok 14 - Does Not Exist\n", 'Does Not Exist' ); +is( $err, <<ERR, ' right diagnostic' ); +# Failed test ($0 at line 239) +# Structures begin differing at: +# \$got->{key} = Does not exist +# \$expected->{key} = $b +ERR |