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 / 15_name2charnum.t
CommitLineData
d7fcd4ce
SP
1
2# Time-stamp: "2004-04-27 19:53:22 ADT"
3
4use strict;
5use Test;
38d111ed 6use utf8;
d7fcd4ce
SP
7
8my @them;
38d111ed 9BEGIN { plan('tests' => 42) };
d7fcd4ce
SP
10BEGIN { print "# Perl version $] under $^O\n" }
11
12use Pod::Escapes qw(:ALL);
13ok 1;
14
15eval " binmode(STDOUT, ':utf8') ";
16
17print "# Pod::Escapes version $Pod::Escapes::VERSION\n";
18print "# I'm ", (chr(65) eq 'A') ? '' : 'not ', "in ASCII world.\n";
19print "#\n#------------------------\n#\n";
20
21print "# 'A' tests...\n";
22ok e2charnum('65'), '65';
23ok e2charnum('x41'), '65';
24ok e2charnum('x041'), '65';
25ok e2charnum('x0041'), '65';
26ok e2charnum('x00041'), '65';
27ok e2charnum('0101'), '65';
28ok e2charnum('00101'), '65';
29ok e2charnum('000101'), '65';
30ok e2charnum('0000101'), '65';
31
32print "# '<' tests...\n";
33ok e2charnum('lt'), '60';
34ok e2charnum('60'), '60';
35ok e2charnum('074'), '60';
36ok e2charnum('0074'), '60';
37ok e2charnum('00074'), '60';
38ok e2charnum('000074'), '60';
39ok e2charnum('x3c'), '60';
40ok e2charnum('x3C'), '60';
41ok e2charnum('x03c'), '60';
42ok e2charnum('x003c'), '60';
43ok e2charnum('x0003c'), '60';
44ok e2charnum('x00003c'), '60';
45
46ok e2charnum('65') ne e2charnum('lt');
47
48print "# eacute tests...\n";
49ok defined e2charnum('eacute');
50
51print "# eacute is <", e2charnum('eacute'), "> which is code ",
52 ord(e2charnum('eacute')), "\n";
53
54ok e2charnum('eacute'), e2charnum('233');
55ok e2charnum('eacute'), e2charnum('0351');
56ok e2charnum('eacute'), e2charnum('xe9');
57ok e2charnum('eacute'), e2charnum('xE9');
58
59print "# pi tests...\n";
60ok defined e2charnum('pi');
61
62print "# pi is <", e2charnum('pi'), "> which is code ",
63 e2charnum('pi'), "\n";
64
65ok e2charnum('pi'), e2charnum('960');
66ok e2charnum('pi'), e2charnum('01700');
67ok e2charnum('pi'), e2charnum('001700');
68ok e2charnum('pi'), e2charnum('0001700');
69ok e2charnum('pi'), e2charnum('x3c0');
70ok e2charnum('pi'), e2charnum('x3C0');
71ok e2charnum('pi'), e2charnum('x03C0');
72ok e2charnum('pi'), e2charnum('x003C0');
73ok e2charnum('pi'), e2charnum('x0003C0');
74
75
76print "# %Name2character_number test...\n";
77
78ok scalar keys %Name2character_number;
79ok defined $Name2character_number{'eacute'};
80ok $Name2character_number{'lt'} eq '60';
81
38d111ed
CBW
82# e2charnum on BENGALI DIGIT SEVEN should return undef
83ok(!defined(e2charnum('৭')));
84
d7fcd4ce 85# End