Commit 98a61083 authored by take_cheeze's avatar take_cheeze

Implement Kernel.fail and Kernel#fail .

parent 12915f95
......@@ -1189,6 +1189,8 @@ mrb_init_kernel(mrb_state *mrb)
mrb_define_method(mrb, krn, "to_s", mrb_any_to_s, MRB_ARGS_NONE()); /* 15.3.1.3.46 */
mrb_define_method(mrb, krn, "__case_eqq", mrb_obj_ceqq, MRB_ARGS_REQ(1)); /* internal */
mrb_define_module_function(mrb, krn, "fail", mrb_f_raise, MRB_ARGS_NONE());
mrb_include_module(mrb, mrb->object_class, mrb->kernel_module);
mrb_alias_method(mrb, mrb->module_class, mrb_intern_lit(mrb, "dup"), mrb_intern_lit(mrb, "clone"));
}
......@@ -563,3 +563,7 @@ assert('stack extend') do
end
end
assert('Kernel.fail, Kernel#fail') do
assert_raise(RuntimeError) { fail }
assert_raise(RuntimeError) { Kernel.fail }
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