summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-11-01 05:47:16 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2012-11-01 05:47:16 -0700
commit88c96966c796e0a0f6089291fcaca70cc1e32709 (patch)
treed4c4c8d94577f35fc9f5ddbf3cd4d692e415f73d
parent57910ca5353e1feba1fb069a876b84a52f33d39f (diff)
parentb9cf5045b7e10ad722475a432db4fe1b38987cbd (diff)
downloadmruby-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.rb17
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
+