require 'test/unit' require 'tmpdir' require 'timeout' class TestIO_M17N < Test::Unit::TestCase ENCS = [ Encoding::ASCII_8BIT, Encoding::EUC_JP, Encoding::Shift_JIS, Encoding::UTF_8 ] def with_tmpdir Dir.mktmpdir {|dir| Dir.chdir(dir) { yield dir } } end def with_pipe(enc=nil) r, w = IO.pipe(enc) begin yield r, w ensure r.close if !r.closed? w.close if !w.closed? end end def generate_file(path, content) open(path, "wb") {|f| f.write content } end def encdump(str) "#{str.dump}.force_encoding(#{str.encoding.name.dump})" end def assert_str_equal(expected, actual, message=nil) full_message = build_message(message, <"euc-jp") {|line| line.inspect } } } end end