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

ruby-changes:27165

From: naruse <ko1@a...>
Date: Wed, 13 Feb 2013 15:36:13 +0900 (JST)
Subject: [ruby-changes:27165] naruse:r39217 (ruby_2_0_0): merge revision(s) 39210:

naruse	2013-02-13 15:35:56 +0900 (Wed, 13 Feb 2013)

  New Revision: 39217

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

  Log:
    merge revision(s) 39210:
    
    Suppress warnings: setting Encoding.default_external

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/test/ruby/test_m17n.rb

Index: ruby_2_0_0/test/ruby/test_m17n.rb
===================================================================
--- ruby_2_0_0/test/ruby/test_m17n.rb	(revision 39216)
+++ ruby_2_0_0/test/ruby/test_m17n.rb	(revision 39217)
@@ -195,31 +195,35 @@ class TestM17N < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_m17n.rb#L195
   end
 
   def test_string_inspect_encoding
-    orig_int = Encoding.default_internal
-    orig_ext = Encoding.default_external
-    Encoding.default_internal = nil
-    [Encoding::UTF_8, Encoding::EUC_JP, Encoding::Windows_31J, Encoding::GB18030].
-      each do |e|
-      Encoding.default_external = e
-      str = "\x81\x30\x81\x30".force_encoding('GB18030')
-      assert_equal(Encoding::GB18030 == e ? %{"#{str}"} : '"\x{81308130}"', str.inspect)
-      str = e("\xa1\x8f\xa1\xa1")
-      expected = "\"\\xA1\x8F\xA1\xA1\"".force_encoding("EUC-JP")
-      assert_equal(Encoding::EUC_JP == e ? expected : "\"\\xA1\\x{8FA1A1}\"", str.inspect)
-      str = s("\x81@")
-      assert_equal(Encoding::Windows_31J == e ? %{"#{str}"} : '"\x{8140}"', str.inspect)
-      str = "\u3042\u{10FFFD}"
-      assert_equal(Encoding::UTF_8 == e ? %{"#{str}"} : '"\u3042\u{10FFFD}"', str.inspect)
-    end
-    Encoding.default_external = Encoding::UTF_8
-    [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE,
-      Encoding::UTF8_SOFTBANK].each do |e|
-      str = "abc".encode(e)
-      assert_equal('"abc"', str.inspect)
+    EnvUtil.suppress_warning do
+      begin
+        orig_int = Encoding.default_internal
+        orig_ext = Encoding.default_external
+        Encoding.default_internal = nil
+        [Encoding::UTF_8, Encoding::EUC_JP, Encoding::Windows_31J, Encoding::GB18030].
+          each do |e|
+          Encoding.default_external = e
+          str = "\x81\x30\x81\x30".force_encoding('GB18030')
+          assert_equal(Encoding::GB18030 == e ? %{"#{str}"} : '"\x{81308130}"', str.inspect)
+          str = e("\xa1\x8f\xa1\xa1")
+          expected = "\"\\xA1\x8F\xA1\xA1\"".force_encoding("EUC-JP")
+          assert_equal(Encoding::EUC_JP == e ? expected : "\"\\xA1\\x{8FA1A1}\"", str.inspect)
+          str = s("\x81@")
+          assert_equal(Encoding::Windows_31J == e ? %{"#{str}"} : '"\x{8140}"', str.inspect)
+          str = "\u3042\u{10FFFD}"
+          assert_equal(Encoding::UTF_8 == e ? %{"#{str}"} : '"\u3042\u{10FFFD}"', str.inspect)
+          end
+        Encoding.default_external = Encoding::UTF_8
+        [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE,
+          Encoding::UTF8_SOFTBANK].each do |e|
+          str = "abc".encode(e)
+          assert_equal('"abc"', str.inspect)
+          end
+      ensure
+        Encoding.default_internal = orig_int
+        Encoding.default_external = orig_ext
+      end
     end
-  ensure
-    Encoding.default_internal = orig_int
-    Encoding.default_external = orig_ext
   end
 
   def test_utf_16_32_inspect
@@ -247,18 +251,22 @@ class TestM17N < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_m17n.rb#L251
   end
 
   def test_object_utf16_32_inspect
-    orig_int = Encoding.default_internal
-    orig_ext = Encoding.default_external
-    Encoding.default_internal = nil
-    Encoding.default_external = Encoding::UTF_8
-    o = Object.new
-    [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE].each do |e|
-      o.instance_eval "undef inspect;def inspect;'abc'.encode('#{e}');end"
-      assert_raise(Encoding::CompatibilityError) { [o].inspect }
+    EnvUtil.suppress_warning do
+      begin
+        orig_int = Encoding.default_internal
+        orig_ext = Encoding.default_external
+        Encoding.default_internal = nil
+        Encoding.default_external = Encoding::UTF_8
+        o = Object.new
+        [Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE].each do |e|
+          o.instance_eval "undef inspect;def inspect;'abc'.encode('#{e}');end"
+          assert_raise(Encoding::CompatibilityError) { [o].inspect }
+        end
+      ensure
+        Encoding.default_internal = orig_int
+        Encoding.default_external = orig_ext
+      end
     end
-  ensure
-    Encoding.default_internal = orig_int
-    Encoding.default_external = orig_ext
   end
 
   def test_object_inspect_external

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r39210


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

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