diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-11-01 05:47:16 -0700 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2012-11-01 05:47:16 -0700 |
| commit | 88c96966c796e0a0f6089291fcaca70cc1e32709 (patch) | |
| tree | d4c4c8d94577f35fc9f5ddbf3cd4d692e415f73d | |
| parent | 57910ca5353e1feba1fb069a876b84a52f33d39f (diff) | |
| parent | b9cf5045b7e10ad722475a432db4fe1b38987cbd (diff) | |
| download | mruby-88c96966c796e0a0f6089291fcaca70cc1e32709.tar.gz mruby-88c96966c796e0a0f6089291fcaca70cc1e32709.zip | |
Merge pull request #522 from bovi/add-test-string-bytes
Add Test for String#bytes
| -rw-r--r-- | test/t/string.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/t/string.rb b/test/t/string.rb index 27af38a4c..26b7df584 100644 --- a/test/t/string.rb +++ b/test/t/string.rb @@ -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 + |
