1
0
Fork 0
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:
akr 2008-02-17 16:50:49 +00:00
parent 583a4b1774
commit c2c32b50b1

View file

@ -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