[perl #59908] \x, \0, and \N{} not ok in double-quotish when followed by > \x100
[p5sagit/p5-mst-13.2.git] / t / uni / lex_utf8.t
1 #
2 # This script is written intentionally in UTF-8
3
4 BEGIN {
5     if (ord("A") == 193) {
6         print "1..0 # Skip: EBCDIC\n";
7         exit 0;
8     }
9     $| = 1;
10 }
11
12 use strict;
13
14 use Test::More tests => 10;
15 use charnames ':full';
16
17 use utf8;
18
19 my $A_with_ogonek = "Ą";
20 my $micro_sign = "µ";
21 my $hex_first = "a\x{A2}Ą";
22 my $hex_last = "aĄ\x{A2}";
23 my $name_first = "b\N{MICRO SIGN}Ɓ";
24 my $name_last = "bƁ\N{MICRO SIGN}";
25 my $uname_first = "b\N{U+00B5}Ɓ";
26 my $uname_last = "bƁ\N{U+00B5}";
27 my $octal_first = "c\377Ć";
28 my $octal_last = "cĆ\377";
29
30 do {
31         use bytes;
32         is((join "", unpack("C*", $A_with_ogonek)), "196" . "132", 'single char above 0x100');
33         is((join "", unpack("C*", $micro_sign)), "194" . "181", 'single char in 0x80 .. 0xFF');
34         is((join "", unpack("C*", $hex_first)), "97" . "194" . "162" . "196" . "132", 'a . \x{A2} . char above 0x100');
35         is((join "", unpack("C*", $hex_last)), "97" . "196" . "132" . "194" . "162", 'a . char above 0x100 . \x{A2}');
36         is((join "", unpack("C*", $name_first)), "98" . "194" . "181" . "198" . "129", 'b . \N{MICRO SIGN} . char above 0x100');
37         is((join "", unpack("C*", $name_last)), "98" . "198" . "129" . "194" . "181", 'b . char above 0x100 . \N{MICRO SIGN}');
38         is((join "", unpack("C*", $uname_first)), "98" . "194" . "181" . "198" . "129", 'b . \N{U+00B5} . char above 0x100');
39         is((join "", unpack("C*", $uname_last)), "98" . "198" . "129" . "194" . "181", 'b . char above 0x100 . \N{U+00B5}');
40         is((join "", unpack("C*", $octal_first)), "99" . "195" . "191" . "196" . "134", 'c . \377 . char above 0x100');
41         is((join "", unpack("C*", $octal_last)), "99" . "196" . "134" . "195" . "191", 'c . char above 0x100 . \377');
42 }
43 __END__
44