summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-26 16:15:17 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-26 16:15:17 +0000
commitc72e5e70d98c63718b2e606e1e1f8c29b1c33677 (patch)
tree46cc1ccce493364176ff4e23b05f29e063454cd8
parenta2ac434a0700d5bd08bf213b4ede09899330f9df (diff)
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@40488 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog17
-rw-r--r--string.c1
-rw-r--r--test/ruby/test_module.rb4
-rw-r--r--test/ruby/test_string.rb8
-rw-r--r--version.h6
5 files changed, 30 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 36c4104018..a7e8dadcac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+Sat Apr 27 00:39:28 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * 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@iDaemons.org>
+
+ * 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@iDaemons.org>
+
+ * 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@fsij.org>
* thread_pthread.c (ruby_init_stack): Add STACK_GROW_DIR_DETECTION.
diff --git a/string.c b/string.c
index 02d2474bc2..1b7d2f8639 100644
--- a/string.c
+++ b/string.c
@@ -4570,7 +4570,6 @@ rb_str_inspect(VALUE str)
}
}
switch (c) {
- case '\0': cc = '0'; break;
case '\n': cc = 'n'; break;
case '\r': cc = 'r'; break;
case '\t': cc = 't'; break;
diff --git a/test/ruby/test_module.rb b/test/ruby/test_module.rb
index 06c1820853..1dd27561b0 100644
--- a/test/ruby/test_module.rb
+++ b/test/ruby/test_module.rb
@@ -590,7 +590,7 @@ class TestModule < Test::Unit::TestCase
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
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
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index 43be67893c..3a60213c2e 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -1984,6 +1984,14 @@ class TestString < Test::Unit::TestCase
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"))
diff --git a/version.h b/version.h
index c54dc97d0e..18202a98fc 100644
--- a/version.h
+++ b/version.h
@@ -1,10 +1,10 @@
#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"