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

ruby-changes:23128

From: naruse <ko1@a...>
Date: Fri, 30 Mar 2012 14:16:06 +0900 (JST)
Subject: [ruby-changes:23128] naruse:r35178 (ruby_1_9_3): merge revision(s) 35146:

naruse	2012-03-30 14:15:51 +0900 (Fri, 30 Mar 2012)

  New Revision: 35178

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

  Log:
    merge revision(s) 35146:
    
    * string.c (str_new_empty): should copy also the encoding as an
      empty substring.  [ruby-dev:45441][Bug #6206]

  Modified files:
    branches/ruby_1_9_3/ChangeLog
    branches/ruby_1_9_3/string.c
    branches/ruby_1_9_3/test/ruby/test_string.rb
    branches/ruby_1_9_3/version.h

Index: ruby_1_9_3/ChangeLog
===================================================================
--- ruby_1_9_3/ChangeLog	(revision 35177)
+++ ruby_1_9_3/ChangeLog	(revision 35178)
@@ -1,3 +1,8 @@
+Fri Mar 30 14:15:40 2012  Nobuyoshi Nakada  <nobu@r...>
+
+	* string.c (str_new_empty): should copy also the encoding as an
+	  empty substring.  [ruby-dev:45441][Bug #6206]
+
 Fri Mar 30 14:14:36 2012  Tadayoshi Funaba  <tadf@d...>
 
 	* ext/date/date_core.c (datetime_s_now): [ruby-core:43256].
Index: ruby_1_9_3/string.c
===================================================================
--- ruby_1_9_3/string.c	(revision 35177)
+++ ruby_1_9_3/string.c	(revision 35178)
@@ -725,6 +725,7 @@
 str_new_empty(VALUE str)
 {
     VALUE v = rb_str_new5(str, 0, 0);
+    rb_enc_copy(v, str);
     OBJ_INFECT(v, str);
     return v;
 }
Index: ruby_1_9_3/version.h
===================================================================
--- ruby_1_9_3/version.h	(revision 35177)
+++ ruby_1_9_3/version.h	(revision 35178)
@@ -1,5 +1,5 @@
 #define RUBY_VERSION "1.9.3"
-#define RUBY_PATCHLEVEL 170
+#define RUBY_PATCHLEVEL 171
 
 #define RUBY_RELEASE_DATE "2012-03-30"
 #define RUBY_RELEASE_YEAR 2012
Index: ruby_1_9_3/test/ruby/test_string.rb
===================================================================
--- ruby_1_9_3/test/ruby/test_string.rb	(revision 35177)
+++ ruby_1_9_3/test/ruby/test_string.rb	(revision 35178)
@@ -1164,6 +1164,12 @@
 
     assert_equal("[2, 3]", [1,2,3].slice!(1,10000).inspect, "moved from btest/knownbug")
 
+    bug6206 = '[ruby-dev:45441]'
+    Encoding.list.each do |enc|
+      next unless enc.ascii_compatible?
+      s = S("a:".force_encoding(enc))
+      assert_equal([enc]*2, s.split(":", 2).map(&:encoding), bug6206)
+    end
   end
 
   def test_squeeze
@@ -1803,6 +1809,13 @@
     assert_raise(TypeError) { "hello".partition(1) }
     def (hyphen = Object.new).to_str; "-"; end
     assert_equal(%w(foo - bar), "foo-bar".partition(hyphen), '[ruby-core:23540]')
+
+    bug6206 = '[ruby-dev:45441]'
+    Encoding.list.each do |enc|
+      next unless enc.ascii_compatible?
+      s = S("a:".force_encoding(enc))
+      assert_equal([enc]*3, s.partition("|").map(&:encoding), bug6206)
+    end
   end
 
   def test_rpartition
@@ -1811,6 +1824,13 @@
     assert_raise(TypeError) { "hello".rpartition(1) }
     def (hyphen = Object.new).to_str; "-"; end
     assert_equal(%w(foo - bar), "foo-bar".rpartition(hyphen), '[ruby-core:23540]')
+
+    bug6206 = '[ruby-dev:45441]'
+    Encoding.list.each do |enc|
+      next unless enc.ascii_compatible?
+      s = S("a:".force_encoding(enc))
+      assert_equal([enc]*3, s.rpartition("|").map(&:encoding), bug6206)
+    end
   end
 
   def test_setter

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

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