diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-05-18 07:23:03 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2001-05-18 07:23:03 +0000 |
commit | 50bd636b8a953239c6900a5df6032cafe9cf956a (patch) | |
tree | 34e37c341adfa2abd3841c5bbd242c10c742d0c3 /t/op | |
parent | 16ad5aca1f5177638c984f3315f96c0cd2f10334 (diff) | |
parent | efb30f323b8a33c623d2f52ac4de2a6e862d909a (diff) | |
download | perl-50bd636b8a953239c6900a5df6032cafe9cf956a.tar.gz |
Integrate mainline.
p4raw-id: //depot/perlio@10154
Diffstat (limited to 't/op')
-rwxr-xr-x | t/op/misc.t | 14 | ||||
-rw-r--r-- | t/op/re_tests | 56 | ||||
-rw-r--r-- | t/op/regmesg.t | 70 |
3 files changed, 76 insertions, 64 deletions
diff --git a/t/op/misc.t b/t/op/misc.t index 730e661912..885fad4ee5 100755 --- a/t/op/misc.t +++ b/t/op/misc.t @@ -358,7 +358,7 @@ print "you die joe!\n" unless "@x" eq 'x y z'; /(?{"{"})/ # Check it outside of eval too EXPECT Sequence (?{...}) not terminated or not {}-balanced at - line 1, within pattern -Sequence (?{...}) not terminated or not {}-balanced before HERE mark in regex m/(?{ << HERE "{"})/ at - line 1. +Sequence (?{...}) not terminated or not {}-balanced in regex; marked by <-- HERE in m/(?{ <-- HERE "{"})/ at - line 1. ######## /(?{"{"}})/ # Check it outside of eval too EXPECT @@ -660,3 +660,15 @@ new_pmop "abcdef"; reset; # coredump in 5.7.1 close STDERR; die; EXPECT +######## +# Bug 20010515.004 +my @h = 1 .. 10; +bad(@h); +sub bad { + undef @h; + print "O"; + print for @_; + print "K"; +} +EXPECT +OK diff --git a/t/op/re_tests b/t/op/re_tests index 806760f8ce..c83d742c19 100644 --- a/t/op/re_tests +++ b/t/op/re_tests @@ -45,9 +45,9 @@ a[b-d]e ace y $& ace a[b-d] aac y $& ac a[-b] a- y $& a- a[b-] a- y $& a- -a[b-a] - c - Invalid [] range "b-a" before HERE mark in regex m/a[b-a << HERE ]/ -a[]b - c - Unmatched [ before HERE mark in regex m/a[ << HERE ]b/ -a[ - c - Unmatched [ before HERE mark in regex m/a[ << HERE / +a[b-a] - c - Invalid [] range "b-a" +a[]b - c - Unmatched [ +a[ - c - Unmatched [ a] a] y $& a] a[]]b a]b y $& a]b a[^bc]d aed y $& aed @@ -95,21 +95,21 @@ a[\S]b a-b y - - ab|cd abc y $& ab ab|cd abcd y $& ab ()ef def y $&-$1 ef- -*a - c - Quantifier follows nothing before HERE mark in regex m/* << HERE a/ -(*)b - c - Quantifier follows nothing before HERE mark in regex m/(* << HERE )b/ +*a - c - Quantifier follows nothing +(*)b - c - Quantifier follows nothing $b b n - - a\ - c - Search pattern not terminated a\(b a(b y $&-$1 a(b- a\(*b ab y $& ab a\(*b a((b y $& a((b a\\b a\b y $& a\b -abc) - c - Unmatched ) before HERE mark in regex m/abc) << HERE / -(abc - c - Unmatched ( before HERE mark in regex m/( << HERE abc/ +abc) - c - Unmatched ) +(abc - c - Unmatched ( ((a)) abc y $&-$1-$2 a-a-a (a)b(c) abc y $&-$1-$2 abc-a-c a+b+c aabbabc y $& abc a{1,}b{1,}c aabbabc y $& abc -a** - c - Nested quantifiers before HERE mark in regex m/a** << HERE / +a** - c - Nested quantifiers a.+?c abcabc y $& abc (a+|b)* ab y $&-$1 ab-b (a+|b){0,} ab y $&-$1 ab-b @@ -117,7 +117,7 @@ a.+?c abcabc y $& abc (a+|b){1,} ab y $&-$1 ab-b (a+|b)? ab y $&-$1 a-a (a+|b){0,1} ab y $&-$1 a-a -)( - c - Unmatched ) before HERE mark in regex m/) << HERE (/ +)( - c - Unmatched ) [^ab]* cde y $& cde abc n - - a* y $& @@ -218,9 +218,9 @@ a[-]?c ac y $& ac 'a[b-d]'i AAC y $& AC 'a[-b]'i A- y $& A- 'a[b-]'i A- y $& A- -'a[b-a]'i - c - Invalid [] range "b-a" before HERE mark in regex m/a[b-a << HERE ]/ -'a[]b'i - c - Unmatched [ before HERE mark in regex m/a[ << HERE ]b/ -'a['i - c - Unmatched [ before HERE mark in regex m/a[ << HERE / +'a[b-a]'i - c - Invalid [] range "b-a" +'a[]b'i - c - Unmatched [ +'a['i - c - Unmatched [ 'a]'i A] y $& A] 'a[]]b'i A]B y $& A]B 'a[^bc]d'i AED y $& AED @@ -232,21 +232,21 @@ a[-]?c ac y $& ac 'ab|cd'i ABC y $& AB 'ab|cd'i ABCD y $& AB '()ef'i DEF y $&-$1 EF- -'*a'i - c - Quantifier follows nothing before HERE mark in regex m/* << HERE a/ -'(*)b'i - c - Quantifier follows nothing before HERE mark in regex m/(* << HERE )b/ +'*a'i - c - Quantifier follows nothing +'(*)b'i - c - Quantifier follows nothing '$b'i B n - - 'a\'i - c - Search pattern not terminated 'a\(b'i A(B y $&-$1 A(B- 'a\(*b'i AB y $& AB 'a\(*b'i A((B y $& A((B 'a\\b'i A\B y $& A\B -'abc)'i - c - Unmatched ) before HERE mark in regex m/abc) << HERE / -'(abc'i - c - Unmatched ( before HERE mark in regex m/( << HERE abc/ +'abc)'i - c - Unmatched ) +'(abc'i - c - Unmatched ( '((a))'i ABC y $&-$1-$2 A-A-A '(a)b(c)'i ABC y $&-$1-$2 ABC-A-C 'a+b+c'i AABBABC y $& ABC 'a{1,}b{1,}c'i AABBABC y $& ABC -'a**'i - c - Nested quantifiers before HERE mark in regex m/a** << HERE / +'a**'i - c - Nested quantifiers 'a.+?c'i ABCABC y $& ABC 'a.*?c'i ABCABC y $& ABC 'a.{0,5}?c'i ABCABC y $& ABC @@ -257,7 +257,7 @@ a[-]?c ac y $& ac '(a+|b)?'i AB y $&-$1 A-A '(a+|b){0,1}'i AB y $&-$1 A-A '(a+|b){0,1}?'i AB y $&-$1 - -')('i - c - Unmatched ) before HERE mark in regex m/) << HERE (/ +')('i - c - Unmatched ) '[^ab]*'i CDE y $& CDE 'abc'i n - - 'a*'i y $& @@ -346,7 +346,7 @@ a(?:b|(c|e){1,2}?|d)+?(.) ace y $1$2 ce (?<!c)b cb n - - (?<!c)b b y - - (?<!c)b b y $& b -(?<%)b - c - Sequence (?<%...) not recognized before HERE mark in regex m/(?<% << HERE )b/ +(?<%)b - c - Sequence (?<%...) not recognized (?:..)*a aba y $& aba (?:..)*?a aba y $& a ^(?:b|a(?=(.)))*\1 abc y $& ab @@ -397,10 +397,10 @@ a(?:b|(c|e){1,2}?|d)+?(.) ace y $1$2 ce '(ab)\d\1'i ab4Ab y $1 ab foo\w*\d{4}baz foobar1234baz y $& foobar1234baz a(?{})b cabd y $& ab -a(?{)b - c - Sequence (?{...}) not terminated or not {}-balanced before HERE mark in regex m/a(?{ << HERE )b/ -a(?{{})b - c - Sequence (?{...}) not terminated or not {}-balanced before HERE mark in regex m/a(?{ << HERE {})b/ +a(?{)b - c - Sequence (?{...}) not terminated or not {}-balanced +a(?{{})b - c - Sequence (?{...}) not terminated or not {}-balanced a(?{}})b - c - -a(?{"{"})b - c - Sequence (?{...}) not terminated or not {}-balanced before HERE mark in regex m/a(?{ << HERE "{"})b/ +a(?{"{"})b - c - Sequence (?{...}) not terminated or not {}-balanced a(?{"\{"})b cabd y $& ab a(?{"{"}})b - c - Unmatched right curly bracket a(?{$bl="\{"}).b caxbd y $bl { @@ -441,7 +441,7 @@ x(~~)*(?:(?:F)?)? x~~ y - - ^(\(+)?blah(?(1)(\)))$ blah y ($2) () ^(\(+)?blah(?(1)(\)))$ blah) n - - ^(\(+)?blah(?(1)(\)))$ (blah n - - -(?(1?)a|b) a c - Switch condition not recognized before HERE mark in regex m/(?(1? << HERE )a|b)/ +(?(1?)a|b) a c - Switch condition not recognized (?(1)a|b|c) a c - Switch (?(condition)... contains too many branches (?(?{0})a|b) a n - - (?(?{0})b|a) a y $& a @@ -473,10 +473,10 @@ $(?<=^(a)) a y $1 a ([[:]+) a:[b]: y $1 :[ ([[=]+) a=[b]= y $1 =[ ([[.]+) a.[b]. y $1 .[ -[a[:xyz: - c - Unmatched [ before HERE mark in regex m/[ << HERE a[:xyz:/ -[a[:xyz:] - c - POSIX class [:xyz:] unknown before HERE mark in regex m/[a[:xyz:] << HERE / +[a[:xyz: - c - Unmatched [ +[a[:xyz:] - c - POSIX class [:xyz:] unknown [a[:]b[:c] abc y $& abc -([a[:xyz:]b]+) pbaq c - POSIX class [:xyz:] unknown before HERE mark in regex m/([a[:xyz:] << HERE b]+)/ +([a[:xyz:]b]+) pbaq c - POSIX class [:xyz:] unknown [a[:]b[:c] abc y $& abc ([[:alpha:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd ([[:alnum:]]+) ABcd01Xy__-- ${nulnul}${ffff} y $1 ABcd01Xy @@ -503,8 +503,8 @@ $(?<=^(a)) a y $1 a ([[:^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 - POSIX class [:foo:] unknown before HERE mark in regex m/[[:foo:] << HERE ]/ -[[:^foo:]] - c - POSIX class [:^foo:] unknown before HERE mark in regex m/[[:^foo:] << HERE ]/ +[[:foo:]] - c - POSIX class [:foo:] unknown +[[:^foo:]] - c - POSIX 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/regmesg.t b/t/op/regmesg.t index 7ee1bb4261..24f6f31f77 100644 --- a/t/op/regmesg.t +++ b/t/op/regmesg.t @@ -13,8 +13,8 @@ my $debug = 1; ## arrays below. The {#} is a meta-marker -- it marks where the marker should ## go. -my $marker1 = "HERE"; -my $marker2 = " << HERE "; +my $marker1 = "<-- HERE"; +my $marker2 = " <-- HERE "; ## ## Key-value pairs of code/error of code that should have fatal errors. @@ -26,75 +26,75 @@ my $inf_m1 = ($Config{reg_infty} || 32767) - 1; my $inf_p1 = $inf_m1 + 2; my @death = ( - '/[[=foo=]]/' => 'POSIX syntax [= =] is reserved for future extensions before {#} mark in regex m/[[=foo=]{#}]/', + '/[[=foo=]]/' => 'POSIX syntax [= =] is reserved for future extensions in regex; marked by {#} in m/[[=foo=]{#}]/', - '/(?<= .*)/' => 'Variable length lookbehind not implemented before {#} mark in regex m/(?<= .*){#}/', + '/(?<= .*)/' => 'Variable length lookbehind not implemented in regex; marked by {#} in m/(?<= .*){#}/', - '/(?<= x{1000})/' => 'Lookbehind longer than 255 not implemented before {#} mark in regex m/(?<= x{1000}){#}/', + '/(?<= x{1000})/' => 'Lookbehind longer than 255 not implemented in regex; marked by {#} in m/(?<= x{1000}){#}/', - '/(?@)/' => 'Sequence (?@...) not implemented before {#} mark in regex m/(?@{#})/', + '/(?@)/' => 'Sequence (?@...) not implemented in regex; marked by {#} in m/(?@{#})/', - '/(?{ 1/' => 'Sequence (?{...}) not terminated or not {}-balanced before {#} mark in regex m/(?{{#} 1/', + '/(?{ 1/' => 'Sequence (?{...}) not terminated or not {}-balanced in regex; marked by {#} in m/(?{{#} 1/', - '/(?(1x))/' => 'Switch condition not recognized before {#} mark in regex m/(?(1x{#}))/', + '/(?(1x))/' => 'Switch condition not recognized in regex; marked by {#} in m/(?(1x{#}))/', - '/(?(1)x|y|z)/' => 'Switch (?(condition)... contains too many branches before {#} mark in regex m/(?(1)x|y|{#}z)/', + '/(?(1)x|y|z)/' => 'Switch (?(condition)... contains too many branches in regex; marked by {#} in m/(?(1)x|y|{#}z)/', - '/(?(x)y|x)/' => 'Unknown switch condition (?(x) before {#} mark in regex m/(?({#}x)y|x)/', + '/(?(x)y|x)/' => 'Unknown switch condition (?(x) in regex; marked by {#} in m/(?({#}x)y|x)/', - '/(?/' => 'Sequence (? incomplete before {#} mark in regex m/(?{#}/', + '/(?/' => 'Sequence (? incomplete in regex; marked by {#} in m/(?{#}/', - '/(?;x/' => 'Sequence (?;...) not recognized before {#} mark in regex m/(?;{#}x/', - '/(?<;x/' => 'Sequence (?<;...) not recognized before {#} mark in regex m/(?<;{#}x/', + '/(?;x/' => 'Sequence (?;...) not recognized in regex; marked by {#} in m/(?;{#}x/', + '/(?<;x/' => 'Sequence (?<;...) not recognized in regex; marked by {#} in m/(?<;{#}x/', - '/((x)/' => 'Unmatched ( before {#} mark in regex m/({#}(x)/', + '/((x)/' => 'Unmatched ( in regex; marked by {#} in m/({#}(x)/', - "/x{$inf_p1}/" => "Quantifier in {,} bigger than $inf_m1 before {#} mark in regex m/x{{#}$inf_p1}/", + "/x{$inf_p1}/" => "Quantifier in {,} bigger than $inf_m1 in regex; marked by {#} in m/x{{#}$inf_p1}/", - '/x{3,1}/' => 'Can\'t do {n,m} with n > m before {#} mark in regex m/x{3,1}{#}/', + '/x{3,1}/' => 'Can\'t do {n,m} with n > m in regex; marked by {#} in m/x{3,1}{#}/', - '/x**/' => 'Nested quantifiers before {#} mark in regex m/x**{#}/', + '/x**/' => 'Nested quantifiers in regex; marked by {#} in m/x**{#}/', - '/x[/' => 'Unmatched [ before {#} mark in regex m/x[{#}/', + '/x[/' => 'Unmatched [ in regex; marked by {#} in m/x[{#}/', - '/*/', => 'Quantifier follows nothing before {#} mark in regex m/*{#}/', + '/*/', => 'Quantifier follows nothing in regex; marked by {#} in m/*{#}/', - '/\p{x/' => 'Missing right brace on \p{} before {#} mark in regex m/\p{{#}x/', + '/\p{x/' => 'Missing right brace on \p{} in regex; marked by {#} in m/\p{{#}x/', - 'use utf8; /[\p{x]/' => 'Missing right brace on \p{} before {#} mark in regex m/[\p{{#}x]/', + 'use utf8; /[\p{x]/' => 'Missing right brace on \p{} in regex; marked by {#} in m/[\p{{#}x]/', - '/(x)\2/' => 'Reference to nonexistent group before {#} mark in regex m/(x)\2{#}/', + '/(x)\2/' => 'Reference to nonexistent group in regex; marked by {#} in m/(x)\2{#}/', 'my $m = "\\\"; $m =~ $m', => 'Trailing \ in regex m/\/', - '/\x{1/' => 'Missing right brace on \x{} before {#} mark in regex m/\x{{#}1/', + '/\x{1/' => 'Missing right brace on \x{} in regex; marked by {#} in m/\x{{#}1/', - 'use utf8; /[\x{X]/' => 'Missing right brace on \x{} before {#} mark in regex m/[\x{{#}X]/', + 'use utf8; /[\x{X]/' => 'Missing right brace on \x{} in regex; marked by {#} in m/[\x{{#}X]/', - '/[[:barf:]]/' => 'POSIX class [:barf:] unknown before {#} mark in regex m/[[:barf:]{#}]/', + '/[[:barf:]]/' => 'POSIX class [:barf:] unknown in regex; marked by {#} in m/[[:barf:]{#}]/', - '/[[=barf=]]/' => 'POSIX syntax [= =] is reserved for future extensions before {#} mark in regex m/[[=barf=]{#}]/', + '/[[=barf=]]/' => 'POSIX syntax [= =] is reserved for future extensions in regex; marked by {#} in m/[[=barf=]{#}]/', - '/[[.barf.]]/' => 'POSIX syntax [. .] is reserved for future extensions before {#} mark in regex m/[[.barf.]{#}]/', + '/[[.barf.]]/' => 'POSIX syntax [. .] is reserved for future extensions in regex; marked by {#} in m/[[.barf.]{#}]/', - '/[z-a]/' => 'Invalid [] range "z-a" before {#} mark in regex m/[z-a{#}]/', + '/[z-a]/' => 'Invalid [] range "z-a" in regex; marked by {#} in m/[z-a{#}]/', ); ## ## Key-value pairs of code/error of code that should have non-fatal warnings. ## @warning = ( - "m/(?p{ 'a' })/" => "(?p{}) is deprecated - use (??{}) before {#} mark in regex m/(?p{#}{ 'a' })/", + "m/(?p{ 'a' })/" => "(?p{}) is deprecated - use (??{}) in regex; marked by {#} in m/(?p{#}{ 'a' })/", - 'm/\b*/' => '\b* matches null string many times before {#} mark in regex m/\b*{#}/', + 'm/\b*/' => '\b* matches null string many times in regex; marked by {#} in m/\b*{#}/', - 'm/[:blank:]/' => 'POSIX syntax [: :] belongs inside character classes before {#} mark in regex m/[:blank:]{#}/', + 'm/[:blank:]/' => 'POSIX syntax [: :] belongs inside character classes in regex; marked by {#} in m/[:blank:]{#}/', - "m'[\\y]'" => 'Unrecognized escape \y in character class passed through before {#} mark in regex m/[\y{#}]/', + "m'[\\y]'" => 'Unrecognized escape \y in character class passed through in regex; marked by {#} in m/[\y{#}]/', - 'm/[a-\d]/' => 'False [] range "a-\d" before {#} mark in regex m/[a-\d{#}]/', - 'm/[\w-x]/' => 'False [] range "\w-" before {#} mark in regex m/[\w-{#}x]/', - "m'\\y'" => 'Unrecognized escape \y passed through before {#} mark in regex m/\y{#}/', + 'm/[a-\d]/' => 'False [] range "a-\d" in regex; marked by {#} in m/[a-\d{#}]/', + 'm/[\w-x]/' => 'False [] range "\w-" in regex; marked by {#} in m/[\w-{#}x]/', + "m'\\y'" => 'Unrecognized escape \y passed through in regex; marked by {#} in m/\y{#}/', ); my $total = (@death + @warning)/2; |