This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Update Pod-Escapes to CPAN version 1.06
[perl5.git] / cpan / Pod-Escapes / t / 10_main.t
CommitLineData
d7fcd4ce
SP
1
2# Time-stamp: "2004-05-07 15:43:11 ADT"
3
4use strict;
5use Test;
6
7my @them;
8BEGIN { plan('tests' => 63) };
9BEGIN { print "# Perl version $] under $^O\n" }
10
11use Pod::Escapes qw(:ALL);
12ok 1;
13
14eval " binmode(STDOUT, ':utf8') ";
15
16print "# Pod::Escapes version $Pod::Escapes::VERSION\n";
17print "# I'm ", (chr(65) eq 'A') ? '' : 'not ', "in ASCII world.\n";
18print "#\n#------------------------\n#\n";
19
20foreach 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
34print "#\n#------------------------\n#\n";
35
36print "# 'A' tests...\n";
37ok e2char('65'), 'A';
38ok e2char('x41'), 'A';
39ok e2char('x041'), 'A';
40ok e2char('x0041'), 'A';
41ok e2char('x00041'), 'A';
42ok e2char('0101'), 'A';
43ok e2char('00101'), 'A';
44ok e2char('000101'), 'A';
45ok e2char('0000101'), 'A';
46
47print "# '<' tests...\n";
48ok e2char('lt'), '<';
49ok e2char('60'), '<';
50ok e2char('074'), '<';
51ok e2char('0074'), '<';
52ok e2char('00074'), '<';
53ok e2char('000074'), '<';
54
55ok e2char('x3c'), '<';
56ok e2char('x3C'), '<';
57ok e2char('x03c'), '<';
58ok e2char('x003c'), '<';
59ok e2char('x0003c'), '<';
60ok e2char('x00003c'), '<';
61ok e2char('0x3c'), '<';
62ok e2char('0x3C'), '<';
63ok e2char('0x03c'), '<';
64ok e2char('0x003c'), '<';
65ok e2char('0x0003c'), '<';
66ok e2char('0x00003c'), '<';
67
68ok e2char('65') ne e2char('lt');
69
70print "# eacute tests...\n";
71ok defined e2char('eacute');
72
73print "# eacute is <", e2char('eacute'), "> which is code ",
74 ord(e2char('eacute')), "\n";
75
76ok e2char('eacute'), e2char('233');
77ok e2char('eacute'), e2char('0351');
78ok e2char('eacute'), e2char('xe9');
79ok e2char('eacute'), e2char('xE9');
80
81print "# pi tests...\n";
82ok defined e2char('pi');
83
84print "# pi is <", e2char('pi'), "> which is code ",
85 ord(e2char('pi')), "\n";
86
87ok e2char('pi'), e2char('960');
88ok e2char('pi'), e2char('01700');
89ok e2char('pi'), e2char('001700');
90ok e2char('pi'), e2char('0001700');
91ok e2char('pi'), e2char('x3c0');
92ok e2char('pi'), e2char('x3C0');
93ok e2char('pi'), e2char('x03C0');
94ok e2char('pi'), e2char('x003C0');
95ok e2char('pi'), e2char('x0003C0');
96
97
98print "# various hash tests...\n";
99
100ok scalar keys %Name2character;
101ok defined $Name2character{'eacute'};
102ok $Name2character{'lt'} eq '<';
103
104ok scalar keys %Latin1Code_to_fallback;
105ok defined $Latin1Code_to_fallback{233};
106
107ok scalar keys %Latin1Char_to_fallback;
108ok defined $Latin1Char_to_fallback{chr(233)};
109
110ok scalar keys %Code2USASCII;
111ok defined $Code2USASCII{65};
112ok $Code2USASCII{65} eq 'A';
113
114