Files
mruby-mruby/mrbgems/mruby-string-ext/test/string.rb
T
2013-03-08 06:30:42 +09:00

19 lines
370 B
Ruby

##
# String(Ext) Test
assert('String#getbyte') do
str1 = "hello"
bytes1 = [104, 101, 108, 108, 111]
assert_equal bytes1[0], str1.getbyte(0)
assert_equal bytes1[-1], str1.getbyte(-1)
assert_equal bytes1[6], str1.getbyte(6)
str2 = "\xFF"
bytes2 = [0xFF]
assert_equal bytes2[0], str2.getbyte(0)
end
assert('String#dump') do
"foo".dump == "\"foo\""
end