require 'test/unit' class TestUTF16 < Test::Unit::TestCase def encdump(obj) case obj when String d = obj.dump if /\.force_encoding\("[A-Za-z0-9.:_+-]*"\)\z/ =~ d d else "#{d}.force_encoding(#{obj.encoding.name.dump})" end when Regexp "Regexp.new(#{encdump(obj.source)}, #{obj.options})" else raise Argument, "unexpected: #{obj.inspect}" 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, < y } a = ary.sort {|x,y| x.casecmp(y) } assert_equal(e, a) end end