Commit | Line | Data |
d7fcd4ce |
1 | |
2 | # Time-stamp: "2004-05-07 15:43:11 ADT" |
3 | |
4 | use strict; |
5 | use Test; |
6 | |
7 | my @them; |
8 | BEGIN { plan('tests' => 63) }; |
9 | BEGIN { print "# Perl version $] under $^O\n" } |
10 | |
11 | use Pod::Escapes qw(:ALL); |
12 | ok 1; |
13 | |
14 | eval " binmode(STDOUT, ':utf8') "; |
15 | |
16 | print "# Pod::Escapes version $Pod::Escapes::VERSION\n"; |
17 | print "# I'm ", (chr(65) eq 'A') ? '' : 'not ', "in ASCII world.\n"; |
18 | print "#\n#------------------------\n#\n"; |
19 | |
20 | foreach my $quotie (qw( \n \r \cm \cj \t \f \b \a \e )) { |
21 | my $val = eval "\"$quotie\""; |
22 | if($@) { |
23 | ok 0; |
24 | print "# Error in evalling quotie \"$quotie\"\n"; |
25 | } elsif(!defined $val) { |
26 | ok 0; |
27 | print "# \"$quotie\" is undef!?\n"; |
28 | } else { |
29 | ok 1; |
30 | print "# \"$quotie\" is ", ord($val), "\n"; |
31 | } |
32 | } |
33 | |
34 | print "#\n#------------------------\n#\n"; |
35 | |
36 | print "# 'A' tests...\n"; |
37 | ok e2char('65'), 'A'; |
38 | ok e2char('x41'), 'A'; |
39 | ok e2char('x041'), 'A'; |
40 | ok e2char('x0041'), 'A'; |
41 | ok e2char('x00041'), 'A'; |
42 | ok e2char('0101'), 'A'; |
43 | ok e2char('00101'), 'A'; |
44 | ok e2char('000101'), 'A'; |
45 | ok e2char('0000101'), 'A'; |
46 | |
47 | print "# '<' tests...\n"; |
48 | ok e2char('lt'), '<'; |
49 | ok e2char('60'), '<'; |
50 | ok e2char('074'), '<'; |
51 | ok e2char('0074'), '<'; |
52 | ok e2char('00074'), '<'; |
53 | ok e2char('000074'), '<'; |
54 | |
55 | ok e2char('x3c'), '<'; |
56 | ok e2char('x3C'), '<'; |
57 | ok e2char('x03c'), '<'; |
58 | ok e2char('x003c'), '<'; |
59 | ok e2char('x0003c'), '<'; |
60 | ok e2char('x00003c'), '<'; |
61 | ok e2char('0x3c'), '<'; |
62 | ok e2char('0x3C'), '<'; |
63 | ok e2char('0x03c'), '<'; |
64 | ok e2char('0x003c'), '<'; |
65 | ok e2char('0x0003c'), '<'; |
66 | ok e2char('0x00003c'), '<'; |
67 | |
68 | ok e2char('65') ne e2char('lt'); |
69 | |
70 | print "# eacute tests...\n"; |
71 | ok defined e2char('eacute'); |
72 | |
73 | print "# eacute is <", e2char('eacute'), "> which is code ", |
74 | ord(e2char('eacute')), "\n"; |
75 | |
76 | ok e2char('eacute'), e2char('233'); |
77 | ok e2char('eacute'), e2char('0351'); |
78 | ok e2char('eacute'), e2char('xe9'); |
79 | ok e2char('eacute'), e2char('xE9'); |
80 | |
81 | print "# pi tests...\n"; |
82 | ok defined e2char('pi'); |
83 | |
84 | print "# pi is <", e2char('pi'), "> which is code ", |
85 | ord(e2char('pi')), "\n"; |
86 | |
87 | ok e2char('pi'), e2char('960'); |
88 | ok e2char('pi'), e2char('01700'); |
89 | ok e2char('pi'), e2char('001700'); |
90 | ok e2char('pi'), e2char('0001700'); |
91 | ok e2char('pi'), e2char('x3c0'); |
92 | ok e2char('pi'), e2char('x3C0'); |
93 | ok e2char('pi'), e2char('x03C0'); |
94 | ok e2char('pi'), e2char('x003C0'); |
95 | ok e2char('pi'), e2char('x0003C0'); |
96 | |
97 | |
98 | print "# various hash tests...\n"; |
99 | |
100 | ok scalar keys %Name2character; |
101 | ok defined $Name2character{'eacute'}; |
102 | ok $Name2character{'lt'} eq '<'; |
103 | |
104 | ok scalar keys %Latin1Code_to_fallback; |
105 | ok defined $Latin1Code_to_fallback{233}; |
106 | |
107 | ok scalar keys %Latin1Char_to_fallback; |
108 | ok defined $Latin1Char_to_fallback{chr(233)}; |
109 | |
110 | ok scalar keys %Code2USASCII; |
111 | ok defined $Code2USASCII{65}; |
112 | ok $Code2USASCII{65} eq 'A'; |
113 | |
114 | |