mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
583a4b1774
commit
c2c32b50b1
1 changed files with 20 additions and 0 deletions
|
@ -136,6 +136,11 @@ EOT
|
|||
assert_equal(255, s1.hex, "#{encdump s1}.hex")
|
||||
end
|
||||
|
||||
def test_oct
|
||||
assert_equal(077, "77".encode("utf-16le").oct)
|
||||
assert_equal(077, "77".encode("utf-16be").oct)
|
||||
end
|
||||
|
||||
def test_count
|
||||
s1 = "aa".force_encoding("utf-16be")
|
||||
s2 = "aa"
|
||||
|
@ -239,4 +244,19 @@ EOT
|
|||
assert_equal(Encoding.find("utf-16be"), Regexp.new(s).encoding,
|
||||
"Regexp.new(#{encdump s}).encoding")
|
||||
end
|
||||
|
||||
def test_gsub
|
||||
s = "abcd".force_encoding("utf-16be")
|
||||
assert_raise(ArgumentError) {
|
||||
s.gsub(Regexp.new(".".encode("utf-16be")), "xy")
|
||||
}
|
||||
end
|
||||
|
||||
def test_split_awk
|
||||
s = " ab cd ".encode("utf-16be")
|
||||
r = s.split(" ".encode("utf-16be"))
|
||||
assert_equal(2, r.length)
|
||||
assert_str_equal("ab".encode("utf-16be"), r[0])
|
||||
assert_str_equal("cd".encode("utf-16be"), r[1])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue