diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-29 18:42:34 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-09-29 18:42:34 +0000 |
commit | a6268be70abc8aaeaad32f287a7068620b432ebb (patch) | |
tree | 06a99a05ace5f56a31be1762fb3860e4c35cdcbb | |
parent | 6ce7bd6f919188381e14476feba929b227fda014 (diff) |
merge revision(s) 51685,51821: [Backport #11488]
* re.c (rb_memsearch_wchar, rb_memsearch_qchar): test matching
till the end of string. [ruby-core:70592] [Bug #11488]
* test/ruby/test_m17n.rb (test_include?, tet_index): add tests by
Tom Stuart.
* test/ruby/test_m17n.rb (test_include?, test_index): add tests by
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51986 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | re.c | 4 | ||||
-rw-r--r-- | test/ruby/test_m17n.rb | 8 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 19 insertions, 3 deletions
@@ -1,3 +1,11 @@ +Wed Sep 30 03:34:25 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * re.c (rb_memsearch_wchar, rb_memsearch_qchar): test matching + till the end of string. [ruby-core:70592] [Bug #11488] + + * test/ruby/test_m17n.rb (test_include?, test_index): add tests by + Tom Stuart. + Wed Sep 30 03:24:29 2015 NARUSE, Yui <naruse@ruby-lang.org> * thread_pthread.c (reserve_stack): ensure the memory is really @@ -227,7 +227,7 @@ rb_memsearch_wchar(const unsigned char *xs, long m, const unsigned char *ys, lon const unsigned char *x = xs, x0 = *xs, *y = ys; enum {char_size = 2}; - for (n -= m; n > 0; n -= char_size, y += char_size) { + for (n -= m; n >= 0; n -= char_size, y += char_size) { if (x0 == *y && memcmp(x+1, y+1, m-1) == 0) return y - ys; } @@ -240,7 +240,7 @@ rb_memsearch_qchar(const unsigned char *xs, long m, const unsigned char *ys, lon const unsigned char *x = xs, x0 = *xs, *y = ys; enum {char_size = 4}; - for (n -= m; n > 0; n -= char_size, y += char_size) { + for (n -= m; n >= 0; n -= char_size, y += char_size) { if (x0 == *y && memcmp(x+1, y+1, m-1) == 0) return y - ys; } diff --git a/test/ruby/test_m17n.rb b/test/ruby/test_m17n.rb index 980f9c86b0..a028e91222 100644 --- a/test/ruby/test_m17n.rb +++ b/test/ruby/test_m17n.rb @@ -1066,6 +1066,10 @@ class TestM17N < Test::Unit::TestCase assert_equal(false, e("\xa1\xa2\xa3\xa4").include?(e("\xa3"))) s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4") assert_equal(false, s.include?(e("\xb0\xa3"))) + bug11488 = '[ruby-core:70592] [Bug #11488]' + each_encoding("abcdef", "def") do |str, substr| + assert_equal(true, str.include?(substr), bug11488) + end end def test_index @@ -1075,6 +1079,10 @@ class TestM17N < Test::Unit::TestCase assert_nil(e("\xa1\xa2\xa3\xa4").rindex(e("\xa3"))) s = e("\xa3\xb0\xa3\xb1\xa3\xb2\xa3\xb3\xa3\xb4") assert_raise(Encoding::CompatibilityError){s.rindex(a("\xb1\xa3"))} + bug11488 = '[ruby-core:70592] [Bug #11488]' + each_encoding("abcdef", "def") do |str, substr| + assert_equal(3, str.index(substr), bug11488) + end end def test_next @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.2.4" #define RUBY_RELEASE_DATE "2015-09-30" -#define RUBY_PATCHLEVEL 176 +#define RUBY_PATCHLEVEL 177 #define RUBY_RELEASE_YEAR 2015 #define RUBY_RELEASE_MONTH 9 |