summaryrefslogtreecommitdiffhomepage
path: root/test/t/string.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/t/string.rb')
-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
+