X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Funi%2Fclass.t;h=3dde5082cbb7ccab157485f4161b59a9a579b89d;hb=67fed61ba7df4193ee696a1f5213265f154533e3;hp=66f3962c1bf103ea7f4c2416ff85f0f3d6260d9f;hpb=53cd54806aabd2c7159c2bd2a9152721d6b02e08;p=p5sagit%2Fp5-mst-13.2.git diff --git a/t/uni/class.t b/t/uni/class.t index 66f3962..3dde508 100644 --- a/t/uni/class.t +++ b/t/uni/class.t @@ -4,7 +4,7 @@ BEGIN { require "test.pl"; } -plan tests => 4334; +plan tests => 10; sub MyUniClass { <updir; - - -# the %utf8::... hashes are already in existence -# because utf8_pva.pl was run by utf8_heavy.pl - -# non-General Category and non-Script -while (my ($abbrev, $files) = each %utf8::PVA_abbr_map) { - my $prop_name = $utf8::PropertyAlias{$abbrev}; - next unless $prop_name; - next if $abbrev eq "gc_sc"; - - for (sort keys %$files) { - my $filename = File::Spec->catfile( - $updir => lib => unicore => lib => $abbrev => "$files->{$_}.pl" - ); - next unless -e $filename; - my ($h1, $h2) = map hex, split /\t/, (do $filename); - my $str = join "", map chr, $h1 .. (($h2 || $h1) + 1); - - for my $p ($prop_name, $abbrev) { - for my $c ($files->{$_}, $_) { - is($str =~ /(\p{$p: $c}+)/ && $1, substr($str, 0, -1)); - is($str =~ /(\P{$p= $c}+)/ && $1, substr($str, -1)); - } - } - } -} - -# General Category and Script -for my $p ('gc', 'sc') { - while (my ($abbr) = each %{ $utf8::PropValueAlias{$p} }) { - my $filename = File::Spec->catfile( - $updir => lib => unicore => lib => gc_sc => "$utf8::PVA_abbr_map{gc_sc}{$abbr}.pl" - ); - - next unless -e $filename; - my ($h1, $h2) = map hex, split /\t/, (do $filename); - my $str = join "", map chr, $h1 .. (($h2 || $h1) + 1); - - for my $x ($p, { gc => 'General Category', sc => 'Script' }->{$p}) { - for my $y ($abbr, $utf8::PropValueAlias{$p}{$abbr}, $utf8::PVA_abbr_map{gc_sc}{$abbr}) { - is($str =~ /(\p{$x: $y}+)/ && $1, substr($str, 0, -1)); - is($str =~ /(\P{$x= $y}+)/ && $1, substr($str, -1)); - is($str =~ /(\p{$y}+)/ && $1, substr($str, 0, -1)); - is($str =~ /(\P{$y}+)/ && $1, substr($str, -1)); - } - } - } -} - -# test extra properties (ASCII_Hex_Digit, Bidi_Control, etc.) -SKIP: -{ - skip "Can't reliably derive class names from file names", 544 if $^O eq 'VMS'; - - # On case tolerant filesystems, Cf.pl will cause a -e test for cf.pl to - # return true. Try to work around this by reading the filenames explicitly - # to get a case sensitive test. N.B. This will fail if filename case is - # not preserved because you might go looking for a class name of CF or cf - # when you really want Cf. Storing case sensitive data in filenames is - # simply not portable. - - my %files; - - my $dirname = File::Spec->catdir($updir => lib => unicore => lib => gc_sc); - opendir D, $dirname or die $!; - @files{readdir D} = (); - closedir D; - - for (keys %utf8::PA_reverse) { - my $leafname = "$utf8::PA_reverse{$_}.pl"; - next unless exists $files{$leafname}; - - my $filename = File::Spec->catfile($dirname, $leafname); - - my ($h1, $h2) = map hex, split /\t/, (do $filename); - my $str = join "", map chr, $h1 .. (($h2 || $h1) + 1); - - for my $x ('gc', 'General Category') { - print "# $filename $x $_, $utf8::PA_reverse{$_}\n"; - for my $y ($_, $utf8::PA_reverse{$_}) { - is($str =~ /(\p{$x: $y}+)/ && $1, substr($str, 0, -1)); - is($str =~ /(\P{$x= $y}+)/ && $1, substr($str, -1)); - is($str =~ /(\p{$y}+)/ && $1, substr($str, 0, -1)); - is($str =~ /(\P{$y}+)/ && $1, substr($str, -1)); - } - } - } -} - -# test the blocks (InFoobar) -for (grep $utf8::Canonical{$_} =~ /^In/, keys %utf8::Canonical) { - my $filename = File::Spec->catfile( - $updir => lib => unicore => lib => gc_sc => "$utf8::Canonical{$_}.pl" - ); - - next unless -e $filename; - my ($h1, $h2) = map hex, split /\t/, (do $filename); - my $str = join "", map chr, $h1 .. (($h2 || $h1) + 1); - - my $blk = $_; - - is($str =~ /(\p{$blk}+)/ && $1, substr($str, 0, -1)); - is($str =~ /(\P{$blk}+)/ && $1, substr($str, -1)); - - $blk =~ s/^In/Block:/; - - is($str =~ /(\p{$blk}+)/ && $1, substr($str, 0, -1)); - is($str =~ /(\P{$blk}+)/ && $1, substr($str, -1)); -} +# The other tests that are based on looking at the generated files are now +# in t/re/uniprops.t