mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15187 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e3604a9e46
commit
bbb7151467
2 changed files with 109 additions and 35 deletions
|
|
@ -10,6 +10,33 @@ class TestUTF16 < Test::Unit::TestCase
|
|||
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
|
||||
|
||||
# tests start
|
||||
|
||||
def test_utf16be_valid_encoding
|
||||
|
|
@ -72,4 +99,8 @@ class TestUTF16 < Test::Unit::TestCase
|
|||
"a#{s}"
|
||||
}
|
||||
end
|
||||
|
||||
def test_slice!
|
||||
enccall("aa".force_encoding("UTF-16BE"), :slice!, -1)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue