[前][次][番号順一覧][スレッド一覧]

ruby-changes:39895

From: usa <ko1@a...>
Date: Tue, 29 Sep 2015 17:30:46 +0900 (JST)
Subject: [ruby-changes:39895] usa:r51976 (ruby_2_1): merge revision(s) 51685: [Backport #11488]

usa	2015-09-29 17:30:33 +0900 (Tue, 29 Sep 2015)

  New Revision: 51976

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51976

  Log:
    merge revision(s) 51685: [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.

  Modified directories:
    branches/ruby_2_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/re.c
    branches/ruby_2_1/test/ruby/test_m17n.rb
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 51975)
+++ ruby_2_1/ChangeLog	(revision 51976)
@@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Tue Sep 29 17:25:14 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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.
+
 Tue Sep 29 17:20:07 2015  NARUSE, Yui  <naruse@r...>
 
 	* thread_pthread.c (reserve_stack): ensure the memory is really
Index: ruby_2_1/re.c
===================================================================
--- ruby_2_1/re.c	(revision 51975)
+++ ruby_2_1/re.c	(revision 51976)
@@ -229,7 +229,7 @@ rb_memsearch_wchar(const unsigned char * https://github.com/ruby/ruby/blob/trunk/ruby_2_1/re.c#L229
     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;
     }
@@ -242,7 +242,7 @@ rb_memsearch_qchar(const unsigned char * https://github.com/ruby/ruby/blob/trunk/ruby_2_1/re.c#L242
     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;
     }
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 51975)
+++ ruby_2_1/version.h	(revision 51976)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.8"
 #define RUBY_RELEASE_DATE "2015-09-29"
-#define RUBY_PATCHLEVEL 402
+#define RUBY_PATCHLEVEL 403
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 9
Index: ruby_2_1/test/ruby/test_m17n.rb
===================================================================
--- ruby_2_1/test/ruby/test_m17n.rb	(revision 51975)
+++ ruby_2_1/test/ruby/test_m17n.rb	(revision 51976)
@@ -1056,6 +1056,10 @@ class TestM17N < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_m17n.rb#L1056
     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
@@ -1065,6 +1069,10 @@ class TestM17N < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_m17n.rb#L1069
     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

Property changes on: ruby_2_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r51685


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]