From 5ddd828eea45d47563e2f249c35e35e40a0bd1d9 Mon Sep 17 00:00:00 2001 From: mame Date: Sat, 31 May 2008 11:28:49 +0000 Subject: * test/ruby/test_regexp.rb: add tests. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@16718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_regexp.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 45a93c897..52f931532 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -669,4 +669,11 @@ class TestRegexp < Test::Unit::TestCase failcheck('[[:alpha:') failcheck('[[:alp:]]') end + + def test_backward + assert_equal(3, "foobar".rindex(/b.r/i)) + assert_equal(nil, "foovar".rindex(/b.r/i)) + assert_equal(3, ("foo" + "bar" * 1000).rindex(/#{"bar"*1000}/)) + assert_equal(4, ("foo\nbar\nbaz\n").rindex(/bar/i)) + end end -- cgit