# buggy :-)
#
my @tests = standard_hash_tests();
+
my @ordinary_results = runtests(\@tests, undef);
foreach my $class ('Tie::RefHash', 'Tie::RefHash::Nestable') {
my @tied_results = runtests(\@tests, $class);
# Now test Tie::RefHash's special powers
my (%h, $h);
-eval { $h = tie %h, 'Tie::RefHash' };
+$h = eval { tie %h, 'Tie::RefHash' };
warn $@ if $@;
test(not $@);
test(ref($h) eq 'Tie::RefHash');
untie %h;
# And now Tie::RefHash::Nestable's differences from Tie::RefHash.
-eval { $h = tie %h, 'Tie::RefHash::Nestable' };
+$h = eval { tie %h, 'Tie::RefHash::Nestable' };
warn $@ if $@;
test(not $@);
test(ref($h) eq 'Tie::RefHash::Nestable');
test((keys %{$h{$ref}}) == 1);
test((keys %{$h{$ref}})[0] eq $ref1);
+
die "expected to run $numtests tests, but ran ", $currtest - 1
if $currtest - 1 != $numtests;
+
+@tests = ();
+undef $ref;
+undef $ref1;
+
exit();
my (%h, $h);
if (defined $class) {
- eval { $h = tie %h, $class };
+ $h = eval { tie %h, $class };
warn $@ if $@;
test(not $@);
test(ref($h) eq $class);
my ($result, $warning, $exception);
local $SIG{__WARN__} = sub { $warning .= $_[0] };
$result = scalar(eval $_);
- $exception = $@ if $@;
+ if ($@)
+ {
+ die "$@:$_" unless defined $class;
+ $exception = $@;
+ }
foreach ($warning, $exception) {
next if not defined;
my $STD_TESTS = <<'END'
join $;, sort keys %h;
join $;, sort values %h;
- { my ($v, %tmp); %tmp{$v}++ while (defined($v = each %h)); dumph(\%tmp) }
- { my ($k, $v, %tmp); $tmp{"$k$;$v"}++ while (($k, $v) = each %h); dumph(\%t
-mp) }
+ { my ($v, %tmp); $tmp{$v}++ while (defined($v = each %h)); dumph(\%tmp) }
+ { my ($k, $v, %tmp); $tmp{"$k$;$v"}++ while (($k, $v) = each %h); dumph(\%tmp) }
END
;
# Test hash slices
my @slicetests;
@slicetests = split /\n/, <<'END'
- @h{} = ();
- @h{} = ('a');
@h{'b'} = ();
@h{'c'} = ('d');
@h{'e'} = ('f', 'g');
}
# Test CLEAR
- push @r, 'clear %h', split(/\n/, $STD_TESTS);
+ push @r, '%h = ();', split(/\n/, $STD_TESTS);
return @r;
}