summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-string-ext/test/string.rb
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2014-03-27 12:15:19 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2014-03-27 12:15:19 +0900
commit5067e7b0640507b1b953609b53a00a1bf14042c1 (patch)
treeeb3975b13412687b8261f60cb82e6d3afefb3da4 /mrbgems/mruby-string-ext/test/string.rb
parent292abdb609386b56cfa75fb0a48e0d564bdc9443 (diff)
parent0df65751c68492285306f9f6f020f3727dfaf51a (diff)
downloadmruby-5067e7b0640507b1b953609b53a00a1bf14042c1.tar.gz
mruby-5067e7b0640507b1b953609b53a00a1bf14042c1.zip
Merge pull request #1959 from mattn/string_hex
Implement String#hex
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