]> git.vpit.fr Git - perl/modules/Hash-Normalize.git/blob - t/20-stash.t
This is 0.01
[perl/modules/Hash-Normalize.git] / t / 20-stash.t
1 #!perl -T
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 5;
7
8 use Hash::Normalize qw<normalize get_normalization>;
9
10 my $cafe_nfc = "caf\x{e9}";
11 my $cafe_nfd = "cafe\x{301}";
12
13 eval <<"CODE";
14 package Hash::Normalize::TestPkg;
15
16 BEGIN { Hash::Normalize::normalize(%Hash::Normalize::TestPkg::) }
17
18 sub $cafe_nfd { return 123 }
19
20 sub get_coffee_nfc { $cafe_nfc() + 1 }
21
22 sub get_coffee_nfd { $cafe_nfd() + 2 }
23
24 package Hash::Normalize::TestPkg2;
25
26 our \@ISA;
27 BEGIN {
28  \@ISA = 'Hash::Normalize::TestPkg';
29 }
30
31 1;
32 CODE
33
34 is $@, '', 'test package compiled properly';
35
36 SKIP: {
37  skip 'eval suffers from The Unicode Bug before perl 5.16' => 4
38                                                            unless "$]" >= 5.016;
39
40  is Hash::Normalize::TestPkg::get_coffee_nfc(), 124, 'nfc func call';
41  is Hash::Normalize::TestPkg::get_coffee_nfd(), 125, 'nfd func call';
42  is Hash::Normalize::TestPkg2->get_coffee_nfc(), 124, 'nfc meth call';
43  is Hash::Normalize::TestPkg2->get_coffee_nfd(), 125, 'nfd meth call';
44 }