File: 103_bugs.t

package info (click to toggle)
libtie-hash-indexed-perl 0.05%2Bds1-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 168 kB
  • sloc: perl: 10; makefile: 10
file content (50 lines) | stat: -rw-r--r-- 1,165 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
################################################################################
#
# $Project: /Tie-Hash-Indexed $
# $Author: mhx $
# $Date: 2006/01/21 12:07:00 +0100 $
# $Revision: 2 $
# $Source: /t/103_bugs.t $
#
################################################################################
# 
# Copyright (c) 2002-2003 Marcus Holland-Moritz. All rights reserved.
# This program is free software; you can redistribute it and/or modify
# it under the same terms as Perl itself.
# 
################################################################################

use Test;

BEGIN { plan tests => 12 };

use Tie::Hash::Indexed;
ok(1);

tie %h, 'Tie::Hash::Indexed';
ok(1);

###----------------------------------------------------------------------------
###  BUG: Deleting hash values while iterating caused segfaults or panics
###
###  Bug spotted by Cristian Cocheci
###----------------------------------------------------------------------------

%h = (
  mhx => 1,
  abc => 2,
  foo => 3,
  bar => 4,
);

ok(scalar keys %h, 4);

$i = 1;

while (my($key, $val) = each %h) {
  my $v = delete $h{$key};
  ok($v, $val);
  ok($v, $i++);
}

ok(scalar keys %h, 0);