summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-string-ext/test/string.rb
diff options
context:
space:
mode:
Diffstat (limited to 'mrbgems/mruby-string-ext/test/string.rb')
-rw-r--r--mrbgems/mruby-string-ext/test/string.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/mrbgems/mruby-string-ext/test/string.rb b/mrbgems/mruby-string-ext/test/string.rb
index c951ea7e3..fc6e6d563 100644
--- a/mrbgems/mruby-string-ext/test/string.rb
+++ b/mrbgems/mruby-string-ext/test/string.rb
@@ -133,3 +133,13 @@ assert('String#rpartition') do
assert_equal ["", "b", "aaaa"], "baaaa".rpartition("b")
assert_equal ["", "", ""], "".rpartition("a")
end
+
+assert('String#hex') do
+ assert_equal 16, "10".hex
+ assert_equal 255, "ff".hex
+ assert_equal 16, "0x10".hex
+ assert_equal (-16), "-0x10".hex
+ assert_equal 0, "xyz".hex
+ assert_equal 16, "10z".hex
+ assert_equal 0, "".hex
+end