6 use Test::More tests => (1 + 2 * 3) * 3 + 4;
8 use Hash::Normalize qw<normalize>;
10 my $cafe_nfc = "caf\x{e9}";
11 my $cafe_nfd = "cafe\x{301}";
15 is_deeply [ sort keys %h1 ], [ 'cafe' ], 'new hash';
19 my $r2 = $h1{$cafe_nfc};
20 my $r3 = $h1{$cafe_nfd};
22 is $r1, 1, "init run $run fetch 1";
23 is $r2, undef, "init run $run fetch 2";
24 is $r3, undef, "init run $run fetch 3";
29 is_deeply [ sort keys %h1 ], [ 'cafe', $cafe_nfc ], 'after store 1';
33 my $r2 = $h1{$cafe_nfc};
34 my $r3 = $h1{$cafe_nfd};
36 is $r1, 1, "store 1 run $run fetch 1";
37 is $r2, 2, "store 1 run $run fetch 2";
38 is $r3, 2, "store 1 run $run fetch 3";
43 is_deeply [ sort keys %h1 ], [ 'cafe', $cafe_nfc ], 'after store 2';
47 my $r2 = $h1{$cafe_nfc};
48 my $r3 = $h1{$cafe_nfd};
50 is $r1, 1, "store 2 run $run fetch 1";
51 is $r2, 3, "store 2 run $run fetch 2";
52 is $r3, 3, "store 2 run $run fetch 3";
58 is_deeply [ sort keys %h2 ], [ 'cafe', $cafe_nfd ], 'list assign';
60 is exists $h1{$cafe_nfd}, 1, 'exists';
62 my $val = delete $h1{$cafe_nfd};
64 is_deeply [ sort keys %h1 ], [ 'cafe' ], 'after delete';