diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-22 05:23:12 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-22 05:23:12 +0000 |
commit | 61e21e82adadc1795de115a9ebe0019245de007d (patch) | |
tree | 8eb45886db85b7730b2ac64a2d7f4c79e0814ab9 /test/ruby/test_string.rb | |
parent | 9cbaeed6eda4c26a488878aeb0d47b976cc02472 (diff) | |
download | ruby-61e21e82adadc1795de115a9ebe0019245de007d.tar.gz |
Apply performance improvement to short byte array search.
* re.c (rb_memsearch_ss): Apply performance improvement to short
byte array search for platforms without memmem(3).
[Feature #6311] [ruby-dev:45530]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-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)) |