more ebcdic testsuite fixups (from Peter Prymmer)
[p5sagit/p5-mst-13.2.git] / t / pragma / utf8.t
1 #!./perl 
2
3 BEGIN {
4     chdir 't' if -d 't';
5     unshift @INC, '../lib';
6     $ENV{PERL5LIB} = '../lib';
7     if ( ord("\t") != 9 ) { # skip on ebcdic platforms
8         print "1..0 # Skip utf8 tests on ebcdic platform.\n";
9         exit;
10     }
11 }
12
13 print "1..12\n";
14
15 my $test = 1;
16
17 sub ok {
18     my ($got,$expect) = @_;
19     print "# expected [$expect], got [$got]\nnot " if $got ne $expect;
20     print "ok $test\n";
21 }
22
23 {
24     use utf8;
25     $_ = ">\x{263A}<"; 
26     s/([\x{80}-\x{10ffff}])/"&#".ord($1).";"/eg; 
27     ok $_, '>&#9786;<';
28     $test++;
29
30     $_ = ">\x{263A}<"; 
31     my $rx = "\x{80}-\x{10ffff}";
32     s/([$rx])/"&#".ord($1).";"/eg; 
33     ok $_, '>&#9786;<';
34     $test++;
35
36     $_ = ">\x{263A}<"; 
37     my $rx = "\\x{80}-\\x{10ffff}";
38     s/([$rx])/"&#".ord($1).";"/eg; 
39     ok $_, '>&#9786;<';
40     $test++;
41
42     $_ = "alpha,numeric"; 
43     m/([[:alpha:]]+)/; 
44     ok $1, 'alpha';
45     $test++;
46
47     $_ = "alphaNUMERICstring";
48     m/([[:^lower:]]+)/; 
49     ok $1, 'NUMERIC';
50     $test++;
51
52     $_ = "alphaNUMERICstring";
53     m/(\p{Ll}+)/; 
54     ok $1, 'alpha';
55     $test++;
56
57     $_ = "alphaNUMERICstring"; 
58     m/(\p{Lu}+)/; 
59     ok $1, 'NUMERIC';
60     $test++;
61
62     $_ = "alpha,numeric"; 
63     m/([\p{IsAlpha}]+)/; 
64     ok $1, 'alpha';
65     $test++;
66
67     $_ = "alphaNUMERICstring";
68     m/([^\p{IsLower}]+)/; 
69     ok $1, 'NUMERIC';
70     $test++;
71
72     $_ = "alpha123numeric456"; 
73     m/([\p{IsDigit}]+)/; 
74     ok $1, '123';
75     $test++;
76
77     $_ = "alpha123numeric456"; 
78     m/([^\p{IsDigit}]+)/; 
79     ok $1, 'alpha';
80     $test++;
81
82     $_ = ",123alpha,456numeric"; 
83     m/([\p{IsAlnum}]+)/; 
84     ok $1, '123alpha';
85     $test++;
86 }