This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8.c: Whitespace only
[perl5.git] / t / lib / warnings / utf8
CommitLineData
f0df466a
JH
1
2 utf8.c AOK
3
4 [utf8_to_uv]
5 Malformed UTF-8 character
6 my $a = ord "\x80" ;
7
8 Malformed UTF-8 character
9 my $a = ord "\xf080" ;
10 <<<<<< this warning can't be easily triggered from perl anymore
11
12 [utf16_to_utf8]
13 Malformed UTF-16 surrogate
93f09d7b 14 <<<<<< Add a test when something actually calls utf16_to_utf8
f0df466a
JH
15
16__END__
17# utf8.c [utf8_to_uv] -W
18BEGIN {
19 if (ord('A') == 193) {
20 print "SKIPPED\n# ebcdic platforms do not generate Malformed UTF-8 warnings.";
21 exit 0;
22 }
23}
24use utf8 ;
25my $a = "snøstorm" ;
26{
27 no warnings 'utf8' ;
28 my $a = "snøstorm";
29 use warnings 'utf8' ;
30 my $a = "snøstorm";
31}
32EXPECT
41432148
JH
33Malformed UTF-8 character (unexpected non-continuation byte 0x73, immediately after start byte 0xf8) at - line 9.
34Malformed UTF-8 character (unexpected non-continuation byte 0x73, immediately after start byte 0xf8) at - line 14.
f0df466a 35########
507b9800 36use warnings 'utf8';
62961d2e
JH
37my $d7ff = chr(0xD7FF);
38my $d800 = chr(0xD800);
39my $dfff = chr(0xDFFF);
40my $e000 = chr(0xE000);
c867b360 41my $feff = chr(0xFEFF);
62961d2e 42my $fffd = chr(0xFFFD);
c867b360 43my $fffe = chr(0xFFFE);
62961d2e
JH
44my $ffff = chr(0xFFFF);
45my $hex4 = chr(0x10000);
46my $hex5 = chr(0x100000);
c867b360 47my $maxm1 = chr(0x10FFFE);
62961d2e 48my $max = chr(0x10FFFF);
507b9800 49no warnings 'utf8';
62961d2e
JH
50my $d7ff = chr(0xD7FF);
51my $d800 = chr(0xD800);
52my $dfff = chr(0xDFFF);
53my $e000 = chr(0xE000);
c867b360 54my $feff = chr(0xFEFF);
62961d2e 55my $fffd = chr(0xFFFD);
c867b360 56my $fffe = chr(0xFFFE);
62961d2e
JH
57my $ffff = chr(0xFFFF);
58my $hex4 = chr(0x10000);
59my $hex5 = chr(0x100000);
c867b360 60my $maxm1 = chr(0x10FFFE);
62961d2e 61my $max = chr(0x10FFFF);
507b9800 62EXPECT
507b9800 63########
62961d2e
JH
64use warnings 'utf8';
65my $d7ff = pack("U", 0xD7FF);
66my $d800 = pack("U", 0xD800);
67my $dfff = pack("U", 0xDFFF);
68my $e000 = pack("U", 0xE000);
c867b360 69my $feff = pack("U", 0xFEFF);
62961d2e 70my $fffd = pack("U", 0xFFFD);
c867b360 71my $fffe = pack("U", 0xFFFE);
62961d2e
JH
72my $ffff = pack("U", 0xFFFF);
73my $hex4 = pack("U", 0x10000);
74my $hex5 = pack("U", 0x100000);
c867b360 75my $maxm1 = pack("U", 0x10FFFE);
62961d2e
JH
76my $max = pack("U", 0x10FFFF);
77no warnings 'utf8';
78my $d7ff = pack("U", 0xD7FF);
79my $d800 = pack("U", 0xD800);
80my $dfff = pack("U", 0xDFFF);
81my $e000 = pack("U", 0xE000);
c867b360 82my $feff = pack("U", 0xFEFF);
62961d2e 83my $fffd = pack("U", 0xFFFD);
c867b360 84my $fffe = pack("U", 0xFFFE);
62961d2e
JH
85my $ffff = pack("U", 0xFFFF);
86my $hex4 = pack("U", 0x10000);
87my $hex5 = pack("U", 0x100000);
c867b360 88my $maxm1 = pack("U", 0x10FFFE);
62961d2e
JH
89my $max = pack("U", 0x10FFFF);
90EXPECT
62961d2e
JH
91########
92use warnings 'utf8';
93my $d7ff = "\x{D7FF}";
94my $d800 = "\x{D800}";
95my $dfff = "\x{DFFF}";
96my $e000 = "\x{E000}";
c867b360 97my $feff = "\x{FEFF}";
62961d2e 98my $fffd = "\x{FFFD}";
c867b360 99my $fffe = "\x{FFFE}";
62961d2e
JH
100my $ffff = "\x{FFFF}";
101my $hex4 = "\x{10000}";
102my $hex5 = "\x{100000}";
c867b360 103my $maxm1 = "\x{10FFFE}";
62961d2e 104my $max = "\x{10FFFF}";
5b311467 105uc($ffff);
62961d2e
JH
106no warnings 'utf8';
107my $d7ff = "\x{D7FF}";
108my $d800 = "\x{D800}";
109my $dfff = "\x{DFFF}";
110my $e000 = "\x{E000}";
c867b360 111my $feff = "\x{FEFF}";
62961d2e 112my $fffd = "\x{FFFD}";
c867b360 113my $fffe = "\x{FFFE}";
62961d2e
JH
114my $ffff = "\x{FFFF}";
115my $hex4 = "\x{10000}";
116my $hex5 = "\x{100000}";
c867b360 117my $maxm1 = "\x{10FFFE}";
62961d2e 118my $max = "\x{10FFFF}";
5b311467 119uc($ffff);
62961d2e 120EXPECT