summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-07-07 21:04:38 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-07-07 21:04:38 +0000
commit3e3318e754fa4289ad1c682811dbe6a31cd59e26 (patch)
treea4d6ae399be66913c32fec7a251d5b14e0cc4816 /t
parent15fe5983b126b2ada551d336b1d5338492041e03 (diff)
parente8c223dfc7b1035dd59e72c90f29f3f8b0634423 (diff)
downloadperl-3e3318e754fa4289ad1c682811dbe6a31cd59e26.tar.gz
integrate cfgperl contents
p4raw-id: //depot/perl@3656
Diffstat (limited to 't')
-rwxr-xr-xt/op/pat.t9
-rw-r--r--t/op/re_tests32
-rwxr-xr-xt/op/regexp.t10
-rwxr-xr-xt/pragma/utf8.t35
-rw-r--r--t/pragma/warn/regcomp48
5 files changed, 95 insertions, 39 deletions
diff --git a/t/op/pat.t b/t/op/pat.t
index a086c12eaf..6312c75cea 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -282,14 +282,7 @@ eval qq("${context}y" =~ /(?<=$context)y/);
print "not " if $@ !~ m%^\Q/(?<=\Ex+/: lookbehind longer than 255 not%;
print "ok 71\n";
-# This one will fail when POSIX character classes do get implemented
-{
- my $w;
- local $^W = 1;
- local $SIG{__WARN__} = sub{$w = shift};
- eval q('a' =~ /[[:alpha:]]/);
- print "not " if $w !~ /^\QCharacter class syntax [: :] is reserved/;
-}
+# removed test
print "ok 72\n";
# Long Monsters
diff --git a/t/op/re_tests b/t/op/re_tests
index 466fc856c9..cbcb7251b1 100644
--- a/t/op/re_tests
+++ b/t/op/re_tests
@@ -474,9 +474,37 @@ $(?<=^(a)) a y $1 a
([[=]+) a=[b]= y $1 =[
([[.]+) a.[b]. y $1 .[
[a[:xyz: - c - /[a[:xyz:/: unmatched [] in regexp
-[a[:xyz:] - c - /[a[:xyz:]/: unmatched [] in regexp
+[a[:xyz:] - c - Character class [:xyz:] unknown
[a[:]b[:c] abc y $& abc
-([a[:xyz:]b]+) pbaq y $1 ba
+([a[:xyz:]b]+) pbaq c - Character class [:xyz:] unknown
+[a[:]b[:c] abc y $& abc
+([[:alpha:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd
+([[:alnum:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy
+([[:ascii:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__-- ${nulnul}
+([[:cntrl:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ${nulnul}
+([[:digit:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 01
+([[:graph:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__--
+([[:lower:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 cd
+([[:print:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__--
+([[:punct:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 __--
+([[:space:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1
+([[:word:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__
+([[:upper:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 AB
+([[:xdigit:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01
+([[:^alpha:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 01
+([[:^alnum:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 __-- ${nulnul}${ffff}
+([[:^ascii:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ${ffff}
+([[:^cntrl:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__--
+([[:^digit:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd
+([[:^lower:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 AB
+([[:^print:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ${nulnul}${ffff}
+([[:^punct:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy
+([[:^space:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy__--
+([[:^word:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 -- ${nulnul}${ffff}
+([[:^upper:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 cd01
+([[:^xdigit:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 Xy__-- ${nulnul}${ffff}
+[[:foo:]] - c - Character class [:foo:] unknown
+[[:^foo:]] - c - Character class [:^foo:] unknown
((?>a+)b) aaab y $1 aaab
(?>(a+))b aaab y $1 aaa
((?>[^()]+)|\([^()]*\))+ ((abc(ade)ufh()()x y $& abc(ade)ufh()()x
diff --git a/t/op/regexp.t b/t/op/regexp.t
index 66b2d1c116..4ffe1362c6 100755
--- a/t/op/regexp.t
+++ b/t/op/regexp.t
@@ -47,6 +47,8 @@ seek(TESTS,0,0);
$. = 0;
$bang = sprintf "\\%03o", ord "!"; # \41 would not be portable.
+$ffff = chr(0xff) x 2;
+$nulnul = "\0" x 2;
$| = 1;
print "1..$numtests\n# $iters iterations\n";
@@ -59,12 +61,16 @@ while (<TESTS>) {
infty_subst(\$pat);
infty_subst(\$expect);
$pat = "'$pat'" unless $pat =~ /^[:']/;
- $pat =~ s/\\n/\n/g;
$pat =~ s/(\$\{\w+\})/$1/eeg;
+ $pat =~ s/\\n/\n/g;
+ $subject =~ s/(\$\{\w+\})/$1/eeg;
$subject =~ s/\\n/\n/g;
+ $expect =~ s/(\$\{\w+\})/$1/eeg;
$expect =~ s/\\n/\n/g;
$expect = $repl = '-' if $skip_amp and $input =~ /\$[&\`\']/;
$skip = ($skip_amp ? ($result =~ s/B//i) : ($result =~ s/B//));
+ # Certain tests don't work with utf8 (the re_test should be in UTF8)
+ $skip = 1 if ($^H &= ~0x00000008) && $pat =~ /\[:\^(alnum|print|word):\]/;
$result =~ s/B//i unless $skip;
for $study ('', 'study \$subject') {
$c = $iters;
@@ -75,7 +81,7 @@ while (<TESTS>) {
last; # no need to study a syntax error
}
elsif ( $skip ) {
- print "ok $. # Skipped: not fixed yet\n"; next TEST;
+ print "ok $. # skipped\n"; next TEST;
}
elsif ($@) {
print "not ok $. $input => error `$err'\n"; next TEST;
diff --git a/t/pragma/utf8.t b/t/pragma/utf8.t
index e5b3bb5cd3..5e467ae053 100755
--- a/t/pragma/utf8.t
+++ b/t/pragma/utf8.t
@@ -6,7 +6,7 @@ BEGIN {
$ENV{PERL5LIB} = '../lib';
}
-print "1..3\n";
+print "1..9\n";
my $test = 1;
@@ -34,4 +34,37 @@ sub ok {
s/([$rx])/"&#".ord($1).";"/eg;
ok $_, '>&#9786;<';
$test++;
+
+ $_ = "alpha,numeric";
+ m/([[:alpha:]]+)/;
+ ok $1, 'alpha';
+ $test++;
+
+ $_ = "alphaNUMERICstring";
+ m/([[:^lower:]]+)/;
+ ok $1, 'NUMERIC';
+ $test++;
+
+ $_ = "alphaNUMERICstring";
+ m/(\p{Ll}+)/;
+ ok $1, 'alpha';
+ $test++;
+
+ $_ = "alphaNUMERICstring";
+ m/(\p{Lu}+)/;
+ ok $1, 'NUMERIC';
+ $test++;
+
+ $_ = "alpha,numeric";
+ m/([\p{IsAlpha}]+)/;
+ ok $1, 'alpha';
+ $test++;
+
+ $_ = "alphaNUMERICstring";
+ m/([^\p{IsLower}]+)/;
+ ok $1, 'NUMERIC';
+ $test++;
+
}
+
+
diff --git a/t/pragma/warn/regcomp b/t/pragma/warn/regcomp
index 4b2f7ff2ba..6545778a38 100644
--- a/t/pragma/warn/regcomp
+++ b/t/pragma/warn/regcomp
@@ -8,9 +8,6 @@
/(?=a)?/
- Character class syntax [: :] is reserved for future extensions
- /[a[:xyz:]b]/
-
Character class syntax [. .] is reserved for future extensions
Character class syntax [= =] is reserved for future extensions
@@ -36,30 +33,29 @@ Strange *+?{} on zero-length expression at - line 4.
# regcomp.c
use warning 'unsafe' ;
$_ = "" ;
-/[a[:xyz:]b]/;
-/[a[.xyz.]b]/;
-/[a[=xyz=]b]/;
+/[:alpha:]/;
+/[.bar.]/;
+/[=zog=]/;
+/[[:alpha:]]/;
+/[[.foo.]]/;
+/[[=bar=]]/;
+/[:zog:]/;
no warning 'unsafe' ;
-/[a[:xyz:]b]/;
-/[a[.xyz.]b]/;
-/[a[=xyz=]b]/;
+/[:alpha:]/;
+/[.foo.]/;
+/[=bar=]/;
+/[[:alpha:]]/;
+/[[.foo.]]/;
+/[[=bar=]]/;
+/[:zog:]/;
+/[[:zog:]]/;
EXPECT
-Character class syntax [: :] is reserved for future extensions at - line 4.
+Character class syntax [: :] belongs inside character classes at - line 4.
+Character class syntax [. .] belongs inside character classes at - line 5.
Character class syntax [. .] is reserved for future extensions at - line 5.
+Character class syntax [= =] belongs inside character classes at - line 6.
Character class syntax [= =] is reserved for future extensions at - line 6.
-########
-# regcomp.c
-use warning 'unsafe' ;
-# use utf8 ; # Note this line should be uncommented when utf8 gets fixed.
-$_ = "" ;
-/[a[:xyz:]b]/;
-/[a[.xyz.]b]/;
-/[a[=xyz=]b]/;
-no warning 'unsafe' ;
-/[a[:xyz:]b]/;
-/[a[.xyz.]b]/;
-/[a[=xyz=]b]/;
-EXPECT
-Character class syntax [: :] is reserved for future extensions at - line 5.
-Character class syntax [. .] is reserved for future extensions at - line 6.
-Character class syntax [= =] is reserved for future extensions at - line 7.
+Character class syntax [. .] is reserved for future extensions at - line 8.
+Character class syntax [= =] is reserved for future extensions at - line 9.
+Character class syntax [: :] belongs inside character classes at - line 10.
+Character class [:zog:] unknown at - line 19.