зеркало из https://github.com/github/ruby.git
* test/ruby/test_array.rb (test_pack): use utf-8.
* test/ruby/test_pack.rb (test_pack_U): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20022 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
34c5cea9b5
Коммит
3056933cc0
|
@ -888,7 +888,7 @@ class TestArray < Test::Unit::TestCase
|
|||
assert_equal("aGVsbG8K\n", @cls["hello\n"].pack("m"))
|
||||
assert_equal(",:&5L;&\\*:&5L;&\\*\n", @cls["hello\nhello\n"].pack("u"))
|
||||
|
||||
assert_equal("\xc2\xa9B\xe2\x89\xa0", @cls[0xa9, 0x42, 0x2260].pack("U*"))
|
||||
assert_equal("\u{a9 42 2260}", @cls[0xa9, 0x42, 0x2260].pack("U*"))
|
||||
|
||||
|
||||
format = "c2x5CCxsdils_l_a6";
|
||||
|
|
|
@ -51,9 +51,9 @@ class TestPack < Test::Unit::TestCase
|
|||
assert_raise(RangeError) { [-0x40000000].pack("U") }
|
||||
assert_raise(RangeError) { [-1].pack("U") }
|
||||
assert_equal "\000", [0].pack("U")
|
||||
assert_equal "\374\277\277\277\277\277", [0x3fffffff].pack("U")
|
||||
assert_equal "\375\200\200\200\200\200", [0x40000000].pack("U")
|
||||
assert_equal "\375\277\277\277\277\277", [0x7fffffff].pack("U")
|
||||
assert_equal "\374\277\277\277\277\277".force_encoding(Encoding::UTF_8), [0x3fffffff].pack("U")
|
||||
assert_equal "\375\200\200\200\200\200".force_encoding(Encoding::UTF_8), [0x40000000].pack("U")
|
||||
assert_equal "\375\277\277\277\277\277".force_encoding(Encoding::UTF_8), [0x7fffffff].pack("U")
|
||||
assert_raise(RangeError) { [0x80000000].pack("U") }
|
||||
assert_raise(RangeError) { [0x100000000].pack("U") }
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче