diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-29 16:00:49 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-29 16:00:49 +0000 |
commit | 1f97d48800a1bc4f4831036100857b491d36680c (patch) | |
tree | 307a48773fcd6571e48163fc4b9af14a60420dbd | |
parent | 595ad416f3187661c3f17b7738a66756827c7ebb (diff) | |
download | ruby-1f97d48800a1bc4f4831036100857b491d36680c.tar.gz |
* test/ruby/test_regexp.rb: add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | test/ruby/test_regexp.rb | 26 | ||||
-rw-r--r-- | version.h | 6 |
3 files changed, 33 insertions, 3 deletions
@@ -1,3 +1,7 @@ +Fri May 30 00:59:47 2008 Yusuke Endoh <mame@tsg.ne.jp> + + * test/ruby/test_regexp.rb: add tests. + Thu May 29 22:51:05 2008 Yusuke Endoh <mame@tsg.ne.jp> * test/ruby/test_require.rb: add a test for load with wrap flag, to diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 17fe9fa45f..9a56ca07c9 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -512,6 +512,17 @@ class TestRegexp < Test::Unit::TestCase check(/\A\a\z/, "\007") check(/\A\e\z/, "\033") check(/\A\v\z/, "\v") + failcheck('(') + failcheck('(?foo)') + end + + def test_parse_look_behind + check(/(?<=A)B(?=C)/, [%w(B ABC)], %w(aBC ABc aBc)) + check(/(?<!A)B(?!C)/, [%w(B aBc)], %w(ABC aBC ABc)) + failcheck('(?<=.*)') + failcheck('(?<!.*)') + check(/(?<=A|B.)C/, [%w(C AC), %w(C BXC)], %w(C BC)) + check(/(?<!A|B.)C/, [%w(C C), %w(C BC)], %w(AC BXC)) end def test_parse_kg @@ -533,6 +544,20 @@ class TestRegexp < Test::Unit::TestCase failcheck('()\g<-2>') check(/\A(?<x>.)(?<x>.)\k<x>\z/, %w(aba abb), %w(abc .. ....)) check(/\k\g/, "kg") + failcheck('(.\g<1>)') + failcheck('(.\g<2>)') + failcheck('(?=\g<1>)') + failcheck('((?=\g<1>))') + failcheck('(\g<1>|.)') + failcheck('(.|\g<1>)') + check(/A*B/, %w(B AB AAB AAAB), %w(A)) + check(/\w*!/, %w(! a! ab! abc!), %w(abc)) + check(/\w*\W/, %w(! a" ab# abc$), %w(abc)) + check(/\w*\w/, %w(z az abz abcz), %w(!)) + check(/[a-z]*\w/, %w(z az abz abcz), %w(!)) + check(/[a-z]*\W/, %w(! a" ab# abc$), %w(A)) + check(/(!)(?<=(a)|\g<1>)/, ["!"], %w(a)) + check(/((a|bb|ccc|dddd)(1|22|333|4444))/i, %w(a1 bb1 a22), %w(a2 b1)) end def test_parse_curly_brace @@ -595,6 +620,7 @@ class TestRegexp < Test::Unit::TestCase check(/\A[a-f&&[^b-c]&&[^e]]\z/, %w(a d f), %w(b c e g 0)) check(/\A[[^b-c]&&[^e]&&a-f]\z/, %w(a d f), %w(b c e g 0)) check(/\A[\n\r\t]\z/, ["\n", "\r", "\t"]) + failcheck('[9-1]') end def test_posix_bracket @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2008-05-28" +#define RUBY_RELEASE_DATE "2008-05-30" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20080528 +#define RUBY_RELEASE_CODE 20080530 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2008 #define RUBY_RELEASE_MONTH 5 -#define RUBY_RELEASE_DAY 28 +#define RUBY_RELEASE_DAY 30 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; |