diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_string.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 2e63eff5a7..cf63048750 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -837,6 +837,13 @@ class TestString < Test::Unit::TestCase assert_equal(0, S("hello").index(S(""))) assert_equal(0, S("hello").index(//)) + s = S("long") * 1000 << "x" + assert_nil(s.index(S("y"))) + assert_equal(4 * 1000, s.index(S("x"))) + s << "yx" + assert_equal(4 * 1000, s.index(S("x"))) + assert_equal(4 * 1000, s.index(S("xyx"))) + o = Object.new def o.to_str; "bar"; end assert_equal(3, "foobarbarbaz".index(o)) |