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

ruby-changes:23960

From: nobu <ko1@a...>
Date: Sun, 10 Jun 2012 15:49:27 +0900 (JST)
Subject: [ruby-changes:23960] nobu:r36011 (trunk): * test/ruby/test_iseq.rb (TestISeq#test_disasm_encoding): set default

nobu	2012-06-10 15:49:16 +0900 (Sun, 10 Jun 2012)

  New Revision: 36011

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

  Log:
    * test/ruby/test_iseq.rb (TestISeq#test_disasm_encoding): set default
      encoding not to be affected by environment variables.

  Modified files:
    trunk/test/ruby/test_iseq.rb

Index: test/ruby/test_iseq.rb
===================================================================
--- test/ruby/test_iseq.rb	(revision 36010)
+++ test/ruby/test_iseq.rb	(revision 36011)
@@ -18,9 +18,11 @@
 
   def test_disasm_encoding
     src = "\u{3042} = 1"
-    enc = Encoding.default_internal || Encoding.default_external
-    assert_equal(enc, RubyVM::InstructionSequence.compile(src.encode(enc)).disasm.encoding)
-    enc = enc == Encoding::UTF_8 ? Encoding::Shift_JIS : Encoding::UTF_8
-    assert_equal(true, RubyVM::InstructionSequence.compile(src.encode(enc)).disasm.ascii_only?)
+    enc, Encoding.default_internal = Encoding.default_internal, src.encoding
+    assert_equal(src.encoding, RubyVM::InstructionSequence.compile(src).disasm.encoding)
+    src.encode!(Encoding::Shift_JIS)
+    assert_equal(true, RubyVM::InstructionSequence.compile(src).disasm.ascii_only?)
+  ensure
+    Encoding.default_internal = enc
   end
 end

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

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