diff options
| author | cubicdaiya <[email protected]> | 2014-03-04 21:58:47 +0900 |
|---|---|---|
| committer | cubicdaiya <[email protected]> | 2014-03-04 21:58:47 +0900 |
| commit | ebe4711df82e70f5ac1be5921a5654f33746e185 (patch) | |
| tree | 7d434e820727520da742a1e1854ae7c2dc742378 /test | |
| parent | 7a607112c6083634821a6a09b35f72f87272cd99 (diff) | |
| download | mruby-ebe4711df82e70f5ac1be5921a5654f33746e185.tar.gz mruby-ebe4711df82e70f5ac1be5921a5654f33746e185.zip | |
fix off-by-one error in String#rindex(fixnum)
null-terminated string should not be included in search targets.
Diffstat (limited to 'test')
| -rw-r--r-- | test/t/string.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/t/string.rb b/test/t/string.rb index 2ebaad1b7..0556d12af 100644 --- a/test/t/string.rb +++ b/test/t/string.rb @@ -330,6 +330,9 @@ assert('String#rindex', '15.2.10.5.31') do assert_nil 'abc'.rindex('d') assert_equal 0, 'abcabc'.rindex('a', 1) assert_equal 3, 'abcabc'.rindex('a', 4) + + assert_equal 3, 'abcabc'.rindex(97) + assert_equal nil, 'abcabc'.rindex(0) end # 'String#scan', '15.2.10.5.32' will be tested in mrbgems. |
