diff options
| author | mattn <[email protected]> | 2014-03-27 11:28:29 +0900 |
|---|---|---|
| committer | mattn <[email protected]> | 2014-03-27 11:28:29 +0900 |
| commit | 0df65751c68492285306f9f6f020f3727dfaf51a (patch) | |
| tree | df1e752a1f7050e28229ce8edb37e2cc1dfe62b7 /mrbgems/mruby-string-ext/test | |
| parent | a4f4db975ad7008384e13be4a14084658ad533f8 (diff) | |
| download | mruby-0df65751c68492285306f9f6f020f3727dfaf51a.tar.gz mruby-0df65751c68492285306f9f6f020f3727dfaf51a.zip | |
Implement String#hex
Diffstat (limited to 'mrbgems/mruby-string-ext/test')
| -rw-r--r-- | mrbgems/mruby-string-ext/test/string.rb | 10 |
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 |
