This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add parallel support 4 Win32 dmake-COREDIR parallelism part 2
[perl5.git] / lib / meta_notation.t
CommitLineData
4b6af431
KW
1#!./perl
2
3BEGIN {
4 chdir 't' if -d 't';
5 @INC = '../lib';
6 require './test.pl';
7}
8
9use strict;
10use warnings;
11
12eval "require 'meta_notation.pm'";
13if ($@) {
14 fail("Could not find 'meta_notation.pm'");
15}
16else {
17
18 is(_meta_notation("\007\010\011\c?Z\x{103}"), "^G^H^I^?Z\x{103}");
19
20 if ($::IS_ASCII || $::IS_ASCII) {
21 is(_meta_notation("\x{c1}\x{e2}"), 'M-AM-b');
22 is(_meta_notation("\x{df}"), 'M-_');
23 }
24 else { # EBCDIC platform
25 # In the first iteration we are looking for a non-ASCII control; in
26 # the second, a regular non-ASCII character. SPACE marks the end of
27 # most controls. We test each to see that they are properly converted
28 # to \x{...}
29 foreach my $start (0x20, ord " ") {
30 for (my $i = $start; $i < 256; $i++) {
31 my $char = chr $i;
32 next if $char =~ /[[:ascii:]]/;
33 is(_meta_notation($char), sprintf("\\x{%X}", $i));
34 last;
35 }
36 }
37 }
38}
39
40done_testing();