This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5db: add tests for v command
[perl5.git] / t / uni / latin2.t
CommitLineData
b5b7b9ad
NC
1#!./perl -w
2
9e08bc66 3BEGIN {
b5efbd1f 4 chdir 't' if -d 't';
9e08bc66 5 require './test.pl';
a15a3d9b 6 skip_all("encoding.pm is no longer supported by the perl core");
9e08bc66
ST
7}
8
9plan tests => 94;
10
55673181 11no warnings 'deprecated';
9e08bc66
ST
12use encoding "latin2"; # iso 8859-2
13
14# U+00C1, \xC1, \301, LATIN CAPITAL LETTER A WITH ACUTE
15# U+0102, \xC3, \402, LATIN CAPITAL LETTER A WITH BREVE
16# U+00E1, \xE1, \303, LATIN SMALL LETTER A WITH ACUTE
17# U+0103, \xE3, \403, LATIN SMALL LETTER A WITH BREVE
18
19ok("\xC1" =~ /\xC1/, '\xC1 to /\xC1/');
20ok("\x{C1}" =~ /\x{C1}/, '\x{C1} to /\x{C1}/');
21ok("\xC3" =~ /\xC3/, '\xC3 to /\xC3/');
22ok("\x{102}" =~ /\xC3/, '\x{102} to /\xC3/');
23ok("\xC3" =~ /\x{C3}/, '\xC3 to /\x{C3}/');
24ok("\x{102}" =~ /\x{C3}/, '\x{102} to /\x{C3}/');
25ok("\xC3" =~ /\x{102}/, '\xC3 to /\x{102}/');
26ok("\x{102}" =~ /\x{102}/, '\x{102} to /\x{102}/');
27
28ok("\xC1" =~ /\xC1/i, '\xC1 to /\xC1/i');
29ok("\xE1" =~ /\xC1/i, '\xE1 to /\xC1/i');
30ok("\xC1" =~ /\xE1/i, '\xC1 to /\xE1/i');
31ok("\xE1" =~ /\xE1/i, '\xE1 to /\xE1/i');
32ok("\x{102}" =~ /\xC3/i, '\x{102} to /\xC3/i');
33ok("\x{103}" =~ /\xC3/i, '\x{103} to /\xC3/i');
34ok("\x{102}" =~ /\xE3/i, '\x{102} to /\xE3/i');
35ok("\x{103}" =~ /\xE3/i, '\x{103} to /\xE3/i');
36
37ok("\xC1" =~ /[\xC1]/, '\xC1 to /[\xC1]/');
38ok("\x{C1}" =~ /[\x{C1}]/, '\x{C1} to /[\x{C1}]/');
39ok("\xC3" =~ /[\xC3]/, '\xC3 to /[\xC3]/');
40ok("\x{102}" =~ /[\xC3]/, '\x{102} to /[\xC3]/');
41ok("\xC3" =~ /[\x{C3}]/, '\xC3 to /[\x{C3}]/');
42ok("\x{102}" =~ /[\x{C3}]/, '\x{102} to /[\x{C3}]/');
43ok("\xC3" =~ /[\x{102}]/, '\xC3 to /[\x{102}]/');
44ok("\x{102}" =~ /[\x{102}]/, '\x{102} to /[\x{102}]/');
45
46ok("\xC1" =~ /[\xC1]/i, '\xC1 to /[\xC1]/i');
47ok("\xE1" =~ /[\xC1]/i, '\xE1 to /[\xC1]/i');
48ok("\xC1" =~ /[\xE1]/i, '\xC1 to /[\xE1]/i');
49ok("\xE1" =~ /[\xE1]/i, '\xE1 to /[\xE1]/i');
50ok("\x{102}" =~ /[\xC3]/i, '\x{102} to /[\xC3]/i');
51ok("\x{103}" =~ /[\xC3]/i, '\x{103} to /[\xC3]/i');
52ok("\x{102}" =~ /[\xE3]/i, '\x{102} to /[\xE3]/i');
53ok("\x{103}" =~ /[\xE3]/i, '\x{103} to /[\xE3]/i');
54
55ok("\xC1" =~ '\xC1', '\xC1 to \'\xC1\'');
56ok("\xC1" =~ '\x{C1}', '\xC1 to \'\x{C1}\'');
57ok("\xC3" =~ '\303', '\xC3 to \'\303\'');
58ok("\xC3" =~ '\x{102}', '\xC3 to \'\x{102}\'');
59ok("\xC1" =~ '[\xC1]', '\xC1 to \'[\xC1]\'');
60ok("\xC1" =~ '[\x{C1}]', '\xC1 to \'[\x{C1}]\'');
61ok("\xC3" =~ '[\303]', '\xC3 to \'[\303]\'');
62ok("\xC3" =~ '[\x{102}]', '\xC3 to \'[\x{102}]\'');
63
64ok("\xC1" =~ /Á/, '\xC1 to /<A-acute>/');
65ok("\xE1" !~ /Á/, '\xE1 to /<A-acute>/');
66ok("\xC1" =~ /Á/i, '\xC1 to /<A-acute>/i');
67ok("\xE1" =~ /Á/i, '\xE1 to /<A-acute>/i');
68ok("\xC1" =~ /[Á]/, '\xC1 to /[<A-acute>]/');
69ok("\xE1" !~ /[Á]/, '\xE1 to /[<A-acute>]/');
70ok("\xC1" =~ /[Á]/i, '\xC1 to /[<A-acute>]/i');
71ok("\xE1" =~ /[Á]/i, '\xE1 to /[<A-acute>]/i');
72
73ok("\xC1\xC1" =~ /Á\xC1/, '\xC1\xC1 to /<A-acute>\xC1/');
74ok("\xC1\xC1" =~ /\xC1Á/, '\xC1\xC1 to /\xC1<A-acute>/');
75ok("\xC1\xC1" =~ /Á\xC1/i, '\xC1\xC1 to /<A-acute>\xC1/i');
76ok("\xC1\xC1" =~ /\xC1Á/i, '\xC1\xC1 to /\xC1<A-acute>/i');
77ok("\xC1\xE1" =~ /Á\xC1/i, '\xC1\xE1 to /<A-acute>\xC1/i');
78ok("\xC1\xE1" =~ /\xC1Á/i, '\xC1\xE1 to /\xC1<A-acute>/i');
79ok("\xE1\xE1" =~ /Á\xC1/i, '\xE1\xE1 to /<A-acute>\xC1/i');
80ok("\xE1\xE1" =~ /\xC1Á/i, '\xE1\xE1 to /\xC1<A-acute>/i');
81
82# \xDF is LATIN SMALL LETTER SHARP S
83
84ok("\xDF" =~ /\xDF/, '\xDF to /\xDF/');
85ok("\xDF" =~ /\xDF/i, '\xDF to /\xDF/i');
86ok("\xDF" =~ /[\xDF]/, '\xDF to /[\xDF]/');
87ok("\xDF" =~ /[\xDF]/i, '\xDF to /[\xDF]/i');
88ok("\xDF" =~ /ß/, '\xDF to /<sharp-s>/');
89ok("\xDF" =~ /ß/i, '\xDF to /<sharp-s>/i');
90ok("\xDF" =~ /[ß]/, '\xDF to /[<sharp-s>]/');
91ok("\xDF" =~ /[ß]/i, '\xDF to /[<sharp-s>]/i');
92
93ok("SS" =~ /\xDF/i, 'SS to /\xDF/i');
94ok("Ss" =~ /\xDF/i, 'Ss to /\xDF/i');
95ok("sS" =~ /\xDF/i, 'sS to /\xDF/i');
96ok("ss" =~ /\xDF/i, 'ss to /\xDF/i');
97ok("SS" =~ /ß/i, 'SS to /<sharp-s>/i');
98ok("Ss" =~ /ß/i, 'Ss to /<sharp-s>/i');
99ok("sS" =~ /ß/i, 'sS to /<sharp-s>/i');
100ok("ss" =~ /ß/i, 'ss to /<sharp-s>/i');
101
102ok("\xC3" =~ /\303/, '\xC1 to /\303/');
103ok("\303" =~ /\303/, '\303 to /\303/');
104ok("\xC3" =~ /\303/i, '\xC1 to /\303/i');
105ok("\xE3" =~ /\303/i, '\xC1 to /\303/i');
106ok("\xC3" =~ /[\303]/, '\xC1 to /[\303]/');
107ok("\303" =~ /[\303]/, '\303 to /[\303]/');
108ok("\xC3" =~ /[\303]/i, '\xC1 to /[\303]/i');
109ok("\xE3" =~ /[\303]/i, '\xC1 to /[\303]/i');
110
111ok("\xC3" =~ /\402/, '\xC1 to /\402/');
112ok("\402" =~ /\402/, '\402 to /\402/');
113ok("\xC3" =~ /\402/i, '\xC1 to /\402/i');
114ok("\xE3" =~ /\402/i, '\xC1 to /\402/i');
115ok("\xC3" =~ /[\402]/, '\xC1 to /[\402]/');
116ok("\402" =~ /[\402]/, '\402 to /[\402]/');
117ok("\xC3" =~ /[\402]/i, '\xC1 to /[\402]/i');
118ok("\xE3" =~ /[\402]/i, '\xC1 to /[\402]/i');
119
120{
121 my $re = '(?i:\xC1)';
122
123 ok("\xC1" =~ $re, '\xC1 to (?i:\xC1)');
124 ok("\xE1" =~ $re, '\xE1 to (?i:\xC1)');
125
126 utf8::downgrade($re);
127
128 ok("\xC1" =~ $re, '\xC1 to (?i:\xC1) down');
129 ok("\xE1" =~ $re, '\xE1 to (?i:\xC1) down');
130
131 utf8::upgrade($re);
132
133 ok("\xC1" =~ $re, '\xC1 to (?i:\xC1) up');
134 ok("\xE1" =~ $re, '\xE1 to (?i:\xC1) up');
135}
136