1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/ruby/test_regexp.rb: add tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2008-05-29 16:00:49 +00:00
parent 595ad416f3
commit 1f97d48800
3 changed files with 33 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -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[];