mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_iseq.rb (TestISeq#test_disasm_encoding): set default
encoding not to be affected by environment variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
5c45a1373a
commit
d9f3198dd9
1 changed files with 6 additions and 4 deletions
|
@ -18,9 +18,11 @@ class TestISeq < Test::Unit::TestCase
|
|||
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue