mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #522 from bovi/add-test-string-bytes
Add Test for String#bytes
This commit is contained in:
@@ -339,3 +339,20 @@ assert('Check the usage of a NUL character') do
|
||||
"qqq\0ppp"
|
||||
end
|
||||
|
||||
assert('String#bytes') do
|
||||
str1 = "hello"
|
||||
bytes1 = [104, 101, 108, 108, 111]
|
||||
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user