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

ruby-changes:40242

From: nobu <ko1@a...>
Date: Wed, 28 Oct 2015 16:56:25 +0900 (JST)
Subject: [ruby-changes:40242] nobu:r52323 (trunk): encoding for inspect

nobu	2015-10-28 16:56:13 +0900 (Wed, 28 Oct 2015)

  New Revision: 52323

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

  Log:
    encoding for inspect
    
    * test/ruby/test_{exception,module,object}.rb: inspect result
      depend on the default external encoding.  [Feature #10881]

  Modified files:
    trunk/test/ruby/test_exception.rb
    trunk/test/ruby/test_module.rb
    trunk/test/ruby/test_object.rb
Index: test/ruby/test_module.rb
===================================================================
--- test/ruby/test_module.rb	(revision 52322)
+++ test/ruby/test_module.rb	(revision 52323)
@@ -686,7 +686,7 @@ class TestModule < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_module.rb#L686
     assert_raise(NameError) { c1.const_set("X\u{3042}".encode("utf-32be"), :foo) }
     assert_raise(NameError) { c1.const_set("X\u{3042}".encode("utf-32le"), :foo) }
     cx = EnvUtil.labeled_class("X\u{3042}")
-    EnvUtil.with_default_internal(Encoding::UTF_8) {
+    EnvUtil.with_default_external(Encoding::UTF_8) {
       assert_raise_with_message(TypeError, /X\u{3042}/) { c1.const_set(cx, :foo) }
     }
   end
Index: test/ruby/test_object.rb
===================================================================
--- test/ruby/test_object.rb	(revision 52322)
+++ test/ruby/test_object.rb	(revision 52323)
@@ -372,15 +372,19 @@ class TestObject < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_object.rb#L372
 
     m = "\u{30e1 30bd 30c3 30c9}"
     c = Class.new
-    assert_raise_with_message(NameError, /#{m}/) do
-      c.class_eval {remove_method m}
+    EnvUtil.with_default_external(Encoding::UTF_8) do
+      assert_raise_with_message(NameError, /#{m}/) do
+        c.class_eval {remove_method m}
+      end
     end
     c = Class.new {
       define_method(m) {}
       remove_method(m)
     }
-    assert_raise_with_message(NameError, /#{m}/) do
-      c.class_eval {remove_method m}
+    EnvUtil.with_default_external(Encoding::UTF_8) do
+      assert_raise_with_message(NameError, /#{m}/) do
+        c.class_eval {remove_method m}
+      end
     end
   end
 
Index: test/ruby/test_exception.rb
===================================================================
--- test/ruby/test_exception.rb	(revision 52322)
+++ test/ruby/test_exception.rb	(revision 52323)
@@ -429,9 +429,11 @@ end.join https://github.com/ruby/ruby/blob/trunk/test/ruby/test_exception.rb#L429
     bug3237 = '[ruby-core:29948]'
     str = "\u2600"
     id = :"\u2604"
-    msg = "undefined method `#{id}' for #{str.inspect}:String"
-    assert_raise_with_message(NoMethodError, msg, bug3237) do
-      str.__send__(id)
+    EnvUtil.with_default_external(Encoding::UTF_8) do
+      msg = "undefined method `#{id}' for #{str.inspect}:String"
+      assert_raise_with_message(NoMethodError, msg, bug3237) do
+        str.__send__(id)
+      end
     end
   end
 

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

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