require 'test/unit' class TestUTF16 < Test::Unit::TestCase def encdump(str) d = str.dump if /\.force_encoding\("[A-Za-z0-9.:_+-]*"\)\z/ =~ d d else "#{d}.force_encoding(#{str.encoding.name.dump})" end end def enccall(recv, meth, *args) desc = '' if String === recv desc << encdump(recv) else desc << recv.inspect end desc << '.' << meth.to_s if !args.empty? desc << '(' args.each_with_index {|a, i| desc << ',' if 0 < i if String === a desc << encdump(a) else desc << a.inspect end } desc << ')' end result = nil assert_nothing_raised(desc) { result = recv.send(meth, *args) } result end def assert_str_equal(expected, actual, message=nil) full_message = build_message(message, <