mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
encoding for inspect
* test/ruby/test_{exception,module,object}.rb: inspect result depend on the default external encoding. [Feature #10881] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a4f838c742
commit
a2369fc2fe
3 changed files with 14 additions and 8 deletions
|
@ -429,9 +429,11 @@ end.join
|
||||||
bug3237 = '[ruby-core:29948]'
|
bug3237 = '[ruby-core:29948]'
|
||||||
str = "\u2600"
|
str = "\u2600"
|
||||||
id = :"\u2604"
|
id = :"\u2604"
|
||||||
msg = "undefined method `#{id}' for #{str.inspect}:String"
|
EnvUtil.with_default_external(Encoding::UTF_8) do
|
||||||
assert_raise_with_message(NoMethodError, msg, bug3237) do
|
msg = "undefined method `#{id}' for #{str.inspect}:String"
|
||||||
str.__send__(id)
|
assert_raise_with_message(NoMethodError, msg, bug3237) do
|
||||||
|
str.__send__(id)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -686,7 +686,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-32be"), :foo) }
|
||||||
assert_raise(NameError) { c1.const_set("X\u{3042}".encode("utf-32le"), :foo) }
|
assert_raise(NameError) { c1.const_set("X\u{3042}".encode("utf-32le"), :foo) }
|
||||||
cx = EnvUtil.labeled_class("X\u{3042}")
|
cx = EnvUtil.labeled_class("X\u{3042}")
|
||||||
EnvUtil.with_default_internal(Encoding::UTF_8) {
|
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
|
end
|
||||||
|
|
|
@ -372,15 +372,19 @@ class TestObject < Test::Unit::TestCase
|
||||||
|
|
||||||
m = "\u{30e1 30bd 30c3 30c9}"
|
m = "\u{30e1 30bd 30c3 30c9}"
|
||||||
c = Class.new
|
c = Class.new
|
||||||
assert_raise_with_message(NameError, /#{m}/) do
|
EnvUtil.with_default_external(Encoding::UTF_8) do
|
||||||
c.class_eval {remove_method m}
|
assert_raise_with_message(NameError, /#{m}/) do
|
||||||
|
c.class_eval {remove_method m}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
c = Class.new {
|
c = Class.new {
|
||||||
define_method(m) {}
|
define_method(m) {}
|
||||||
remove_method(m)
|
remove_method(m)
|
||||||
}
|
}
|
||||||
assert_raise_with_message(NameError, /#{m}/) do
|
EnvUtil.with_default_external(Encoding::UTF_8) do
|
||||||
c.class_eval {remove_method m}
|
assert_raise_with_message(NameError, /#{m}/) do
|
||||||
|
c.class_eval {remove_method m}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue