summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2006-10-12 02:46:50 +0200
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-10-12 08:43:20 +0000
commit0a4db386e1881073eaec2c3026e38146ff1d6b18 (patch)
tree22dc82474a42a26c55deb83dfafc99ada28994c9 /t
parent6980eebd7cd40424ba72081bd69d31d2b7576f4f (diff)
downloadperl-0a4db386e1881073eaec2c3026e38146ff1d6b18.tar.gz
Add Regex conditionals. Various bugfixes. More tests.
Message-ID: <9b18b3110610111546j74ca490dg21bd9fd1e7e10d42@mail.gmail.com> p4raw-id: //depot/perl@28998
Diffstat (limited to 't')
-rwxr-xr-xt/op/pat.t10
-rw-r--r--t/op/re_tests22
2 files changed, 29 insertions, 3 deletions
diff --git a/t/op/pat.t b/t/op/pat.t
index 465757df1d..a6ea46c8f5 100755
--- a/t/op/pat.t
+++ b/t/op/pat.t
@@ -3714,9 +3714,13 @@ sub iseq($$;$) {
iseq(0+@k, 3, 'Got 3 keys in %+ via keys');
iseq("@k","A B C", "Got expected keys");
iseq("@v","bar baz foo", "Got expected values");
+ eval'
+ print for $+{this_key_doesnt_exist};
+ ';
+ ok(!$@,'lvalue $+{...} should not throw an exception');
}
-
-
+
+
# stress test CURLYX/WHILEM.
#
# This test includes varying levels of nesting, and according to
@@ -3831,5 +3835,5 @@ ok((q(a)x 100) =~ /^(??{'(.)'x 100})/,
or print "# Unexpected outcome: should pass or crash perl\n";
# Don't forget to update this!
-BEGIN{print "1..1274\n"};
+BEGIN{print "1..1275\n"};
diff --git a/t/op/re_tests b/t/op/re_tests
index 83de44ad5a..9f0e06b4d2 100644
--- a/t/op/re_tests
+++ b/t/op/re_tests
@@ -1040,3 +1040,25 @@ X(?<=foo.)[YZ] ..XfooXY.. y pos 8
/^(?'main'<(?:[^<>]+|(?&crap)|(?&main))*>)(?'empty')(?'crap'!>!>!>)$/ <<!>!>!>><>>!>!>!> y $+{main} <<!>!>!>><>>
/^(?'main'<(?:[^<>]+|(?&main))*>)$/ <<><<<><>>>> y $1 <<><<<><>>>>
/(?'first'(?&second)*)(?'second'[fF]o+)/ fooFoFoo y $+{first}-$+{second} fooFo-Foo
+(?<A>foo)?(?(<A>)bar|nada) foobar y $+{A} foo
+(?<A>foo)?(?(<A>)bar|nada) foo-barnada y $& nada
+(?<A>foo)?(?(1)bar|nada) foo-barnada y $& nada
+(?<A>foo(?(R)bar))?(?1) foofoobar y $1 foo
+(?<A>foo(?(R)bar))?(?1) foofoobar y $& foofoobar
+(x)(?<A>foo(?(R&A)bar))?(?&A) xfoofoobar y $2 foo
+(x)(?<A>foo(?(R&A)bar))?(?&A) xfoofoobar y $& xfoofoobar
+(x)(?<A>foo(?(R2)bar))?(?&A) xfoofoobar y $2 foo
+(x)(?<A>foo(?(R2)bar))?(?&A) xfoofoobar y $& xfoofoobar
+(?1)(?(DEFINE)(blah)) blah y $& blah
+/^(?<PAL>(?<CHAR>.)((?&PAL)|.?)\k<CHAR>)$/ madamimadam y $& madamimadam
+/^(?<PAL>(?<CHAR>.)((?&PAL)|.?)\k<CHAR>)$/ madamiamadam n - -
+/(a)?((?1))(fox)/ aafox y $1-$2-$3 a-a-fox
+/(a)*((?1))(fox)/ aafox y $1-$2-$3 a-a-fox
+/(a)+((?1))(fox)/ aafox y $1-$2-$3 a-a-fox
+/(a){1,100}((?1))(fox)/ aafox y $1-$2-$3 a-a-fox
+/(a){0,100}((?1))(fox)/ aafox y $1-$2-$3 a-a-fox
+/(ab)?((?1))(fox)/ ababfox y $1-$2-$3 ab-ab-fox
+/(ab)*((?1))(fox)/ ababfox y $1-$2-$3 ab-ab-fox
+/(ab)+((?1))(fox)/ ababfox y $1-$2-$3 ab-ab-fox
+/(ab){1,100}((?1))(fox)/ ababfox y $1-$2-$3 ab-ab-fox
+/(ab){0,100}((?1))(fox)/ ababfox y $1-$2-$3 ab-ab-fox