1 |
use strict; |
2 |
|
3 |
require Test::Simple; |
4 |
my $case = 0; |
5 |
|
6 |
my $err; |
7 |
|
8 |
my @test = ( |
9 |
sub { |
10 |
eval q{use Char::Class::XML qw/InXMLNameChar/; 1} or die $@; |
11 |
my $s = 'NAME'; |
12 |
ok (scalar ($s =~ /\p{InXMLNameChar}/), '{NameChar}'); |
13 |
ok (scalar ($s =~ /\p{InXMLNameChar}+/), '{NameChar}+'); |
14 |
ok (scalar ($s =~ /^\p{InXMLNameChar}+$/), '^{NameChar}+$'); |
15 |
}, '','', |
16 |
sub { |
17 |
package foo; |
18 |
eval q{use Char::Class::XML qw/InXML_NameStartChar/; 1} or die $@; |
19 |
my $s = 'NAME'; |
20 |
main::ok (scalar ($s =~ /\p{InXML_NameStartChar}/), '{foo::NameStartChar}'); |
21 |
main::ok (scalar ($s =~ /\p{InXML_NameStartChar}+/), '{foo::NameStartChar}+'); |
22 |
main::ok (scalar ($s =~ /^\p{InXML_NameStartChar}+$/), '^{foo::NameStartChar}+$'); |
23 |
}, '','', |
24 |
sub { |
25 |
eval q{use Char::Class::XML qw/InXMLNCNameChar InXML_NCNameStartChar/; 1} |
26 |
or die $@; |
27 |
my $s = 'NAME'; |
28 |
my $ncname = qr/\p{InXML_NCNameStartChar}\p{InXMLNCNameChar}*/; |
29 |
ok (scalar ($s =~ /^$ncname$/), 'ncname check'); |
30 |
ok (scalar ($s =~ /^$ncname(?::$ncname)?$/), 'qname check'); |
31 |
|
32 |
$s = qq(NAME\x{4E00}\x{8123}); |
33 |
ok (scalar ($s =~ /^$ncname$/), 'ncname check'); |
34 |
ok (scalar ($s =~ /^$ncname(?::$ncname)?$/), 'qname check'); |
35 |
|
36 |
$s = qq(foo:bar); |
37 |
ok (!scalar ($s =~ /^$ncname$/), 'ncname check'); |
38 |
ok (scalar ($s =~ /^$ncname(?::$ncname)?$/), 'qname check'); |
39 |
},'','','','','', |
40 |
); |
41 |
$case += @test; |
42 |
$case += @test; |
43 |
|
44 |
Test::Simple->import (tests => $case); |
45 |
|
46 |
for (1,2) { |
47 |
for (@test) {&$_ if ref $_} |
48 |
} |
49 |
|
50 |
|
51 |
=head1 LICENSE |
52 |
|
53 |
Copyright 2003 Wakaba <w@suika.fam.cx> |
54 |
|
55 |
This program is free software; you can redistribute it and/or |
56 |
modify it under the same terms as Perl itself. |
57 |
|
58 |
=cut |
59 |
|
60 |
1; # $Date: 2003/08/05 12:20:00 $ |