зеркало из https://github.com/github/ruby.git
* lib/test/unit.rb (assert_equal): avoid incompatible character
encodings error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
338253cbe5
Коммит
ba1e27f3ca
|
@ -1,3 +1,8 @@
|
|||
Thu Oct 16 23:27:27 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/test/unit.rb (assert_equal): avoid incompatible character
|
||||
encodings error.
|
||||
|
||||
Thu Oct 16 23:23:27 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/test/unit.rb (assert_equal): failure message changed.
|
||||
|
|
|
@ -102,6 +102,16 @@ module Test
|
|||
exp_comment = " (nsec=#{exp.nsec})"
|
||||
act_comment = " (nsec=#{act.nsec})"
|
||||
end
|
||||
elsif !Encoding.compatible?(exp_str, act_str)
|
||||
if exp.is_a?(String) && act.is_a?(String)
|
||||
exp_str = exp.dump
|
||||
act_str = act.dump
|
||||
exp_comment = " (#{exp.encoding})"
|
||||
act_comment = " (#{act.encoding})"
|
||||
else
|
||||
exp_str = exp_str.dump
|
||||
act_str = act_str.dump
|
||||
end
|
||||
end
|
||||
"<#{exp_str}>#{exp_comment} expected but was\n<#{act_str}>#{act_comment}"
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче