Commit aa73a106 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #966 from monaka/pr-add-dump-method-to-String-class

Add String#dump method.
parents f9fd5d9d 63a56ddd
...@@ -21,7 +21,8 @@ mrb_mruby_string_ext_gem_init(mrb_state* mrb) ...@@ -21,7 +21,8 @@ mrb_mruby_string_ext_gem_init(mrb_state* mrb)
{ {
struct RClass * s = mrb->string_class; struct RClass * s = mrb->string_class;
mrb_define_method(mrb, s, "getbyte", mrb_str_getbyte, ARGS_REQ(1)); mrb_define_method(mrb, s, "dump", mrb_str_dump, ARGS_NONE());
mrb_define_method(mrb, s, "getbyte", mrb_str_getbyte, ARGS_REQ(1));
} }
void void
......
...@@ -13,3 +13,6 @@ assert('String#getbyte') do ...@@ -13,3 +13,6 @@ assert('String#getbyte') do
assert_equal bytes2[0], str2.getbyte(0) assert_equal bytes2[0], str2.getbyte(0)
end end
assert('String#dump') do
"foo".dump == "\"foo\""
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment