mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
assertions.rb: set default internal encoding
* test/lib/test/unit/assertions.rb (assert_raise_with_message): set default internal encoding to the excpected message, which affects String#inspect in messages. * test/lib/test/unit/assertions.rb (assert_warning): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
56417d1f24
commit
404bf57aaf
13 changed files with 53 additions and 78 deletions
|
@ -258,7 +258,7 @@ class TestModule < Test::Unit::TestCase
|
|||
"\u3042",
|
||||
"Name?",
|
||||
].each do |name, msg|
|
||||
expected = "wrong constant name %s" % quote(name)
|
||||
expected = "wrong constant name %s" % name
|
||||
msg = "#{msg}#{': ' if msg}wrong constant name #{name.dump}"
|
||||
assert_raise_with_message(NameError, expected, "#{msg} to #{m}") do
|
||||
yield name
|
||||
|
@ -709,9 +709,7 @@ class TestModule < Test::Unit::TestCase
|
|||
assert_raise(NameError) { c1.const_set("X\u{3042}".encode("utf-32be"), :foo) }
|
||||
assert_raise(NameError) { c1.const_set("X\u{3042}".encode("utf-32le"), :foo) }
|
||||
cx = EnvUtil.labeled_class("X\u{3042}")
|
||||
EnvUtil.with_default_external(Encoding::UTF_8) {
|
||||
assert_raise_with_message(TypeError, /X\u{3042}/) { c1.const_set(cx, :foo) }
|
||||
}
|
||||
assert_raise_with_message(TypeError, /X\u{3042}/) { c1.const_set(cx, :foo) }
|
||||
end
|
||||
|
||||
def test_const_get_invalid_name
|
||||
|
@ -1967,10 +1965,7 @@ class TestModule < Test::Unit::TestCase
|
|||
|
||||
name = "@\u{5909 6570}"
|
||||
assert_warning(/instance variable #{name} not initialized/) do
|
||||
val = EnvUtil.with_default_external(Encoding::UTF_8) {
|
||||
a.instance_eval(name)
|
||||
}
|
||||
assert_nil(val)
|
||||
assert_nil(a.instance_eval(name))
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue