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

ruby-changes:28436

From: nagachika <ko1@a...>
Date: Sat, 27 Apr 2013 01:15:30 +0900 (JST)
Subject: [ruby-changes:28436] nagachika:r40488 (ruby_2_0_0): merge revision(s) 40413,40414,40415,40423: [Backport #8290]

nagachika	2013-04-27 01:15:17 +0900 (Sat, 27 Apr 2013)

  New Revision: 40488

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

  Log:
    merge revision(s) 40413,40414,40415,40423: [Backport #8290]
    
    * string.c (rb_str_inspect): NUL should not be represented as
      "\0" when octal digits may follow.
    
    * string.c (rb_str_inspect): NUL should not be represented as "\0"
      when octal digits may follow.  [ruby-core:54458] [Bug #8290]
    
    * test/ruby/test_module.rb
      (TestModule#test_const_get_invalid_name)
      (test_const_defined_invalid_name): Fix expected values.
    
    * string.c (rb_str_inspect): refix r40413, on Ruby 1.9 usual character
      escape uses hex/Unicode escapes, so fix to use Unicode escape on
      Unicode strings and hex on others. [ruby-core:54458] [Bug #8290]

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/string.c
    branches/ruby_2_0_0/test/ruby/test_module.rb
    branches/ruby_2_0_0/test/ruby/test_string.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 40487)
+++ ruby_2_0_0/ChangeLog	(revision 40488)
@@ -1,3 +1,20 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sat Apr 27 00:39:28 2013  NARUSE, Yui  <naruse@r...>
+
+	* string.c (rb_str_inspect): refix r40413, on Ruby 1.9 usual character
+	  escape uses hex/Unicode escapes, so fix to use Unicode escape on
+	  Unicode strings and hex on others. [ruby-core:54458] [Bug #8290]
+
+Sat Apr 27 00:39:28 2013  Akinori MUSHA  <knu@i...>
+
+	* test/ruby/test_module.rb
+	  (TestModule#test_const_get_invalid_name)
+	  (test_const_defined_invalid_name): Fix expected values.
+
+Sat Apr 27 00:39:28 2013  Akinori MUSHA  <knu@i...>
+
+	* string.c (rb_str_inspect): NUL should not be represented as "\0"
+	  when octal digits may follow.  [ruby-core:54458] [Bug #8290]
+
 Fri Apr 26 23:48:58 2013  Tanaka Akira  <akr@f...>
 
 	* thread_pthread.c (ruby_init_stack): Add STACK_GROW_DIR_DETECTION.
Index: ruby_2_0_0/string.c
===================================================================
--- ruby_2_0_0/string.c	(revision 40487)
+++ ruby_2_0_0/string.c	(revision 40488)
@@ -4570,7 +4570,6 @@ rb_str_inspect(VALUE str) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/string.c#L4570
 	    }
 	}
 	switch (c) {
-	  case '\0': cc = '0'; break;
 	  case '\n': cc = 'n'; break;
 	  case '\r': cc = 'r'; break;
 	  case '\t': cc = 't'; break;
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 40487)
+++ ruby_2_0_0/version.h	(revision 40488)
@@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
-#define RUBY_RELEASE_DATE "2013-04-26"
-#define RUBY_PATCHLEVEL 172
+#define RUBY_RELEASE_DATE "2013-04-27"
+#define RUBY_PATCHLEVEL 173
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 4
-#define RUBY_RELEASE_DAY 26
+#define RUBY_RELEASE_DAY 27
 
 #include "ruby/version.h"
 
Index: ruby_2_0_0/test/ruby/test_module.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_module.rb	(revision 40487)
+++ ruby_2_0_0/test/ruby/test_module.rb	(revision 40488)
@@ -590,7 +590,7 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_module.rb#L590
     assert_raise(TypeError, bug5084) { c1.const_get(1) }
     bug7574 = '[ruby-dev:46749]'
     e = assert_raise(NameError) { Object.const_get("String\0") }
-    assert_equal("wrong constant name \"String\\0\"", e.message, bug7574)
+    assert_equal("wrong constant name \"String\\u0000\"", e.message, bug7574)
   end
 
   def test_const_defined_invalid_name
@@ -600,7 +600,7 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_module.rb#L600
     assert_raise(TypeError, bug5084) { c1.const_defined?(1) }
     bug7574 = '[ruby-dev:46749]'
     e = assert_raise(NameError) { Object.const_defined?("String\0") }
-    assert_equal("wrong constant name \"String\\0\"", e.message, bug7574)
+    assert_equal("wrong constant name \"String\\u0000\"", e.message, bug7574)
   end
 
   def test_const_get_no_inherited
Index: ruby_2_0_0/test/ruby/test_string.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_string.rb	(revision 40487)
+++ ruby_2_0_0/test/ruby/test_string.rb	(revision 40488)
@@ -1984,6 +1984,14 @@ class TestString < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_string.rb#L1984
     assert_instance_of(String, s.to_s)
   end
 
+  def test_inspect_nul
+    bug8290 = '[ruby-core:54458]'
+    s = "\0" + "12"
+    assert_equal '"\u000012"', s.inspect, bug8290
+    s = "\0".b + "12"
+    assert_equal '"\x0012"', s.inspect, bug8290
+  end
+
   def test_partition
     assert_equal(%w(he l lo), "hello".partition(/l/))
     assert_equal(%w(he l lo), "hello".partition("l"))

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r40413-40415,40423


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

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