Add Test for String#each_byte

This commit is contained in:
Daniel Bovensiepen
2012-11-01 16:40:31 +08:00
parent 8d9f5628ed
commit b9cf5045b7
+10
View File
@@ -346,3 +346,13 @@ assert('String#bytes') do
str1.bytes == bytes1
end
assert('String#each_byte') do
str1 = "hello"
bytes1 = [104, 101, 108, 108, 111]
bytes2 = []
str1.each_byte {|b| bytes2 << b }
bytes1 == bytes2
end