Remove cname duplication from exc_inspect().

parent e6b5c75e
...@@ -166,13 +166,10 @@ exc_inspect(mrb_state *mrb, mrb_value exc) ...@@ -166,13 +166,10 @@ exc_inspect(mrb_state *mrb, mrb_value exc)
else { else {
const char *cname = mrb_obj_classname(mrb, exc); const char *cname = mrb_obj_classname(mrb, exc);
str = mrb_str_new_cstr(mrb, cname); str = mrb_str_new_cstr(mrb, cname);
mrb_str_cat_lit(mrb, str, ": ");
if (append_mesg) { if (append_mesg) {
mrb_str_cat_lit(mrb, str, ": ");
mrb_str_cat_str(mrb, str, mesg); mrb_str_cat_str(mrb, str, mesg);
} }
else {
mrb_str_cat_cstr(mrb, str, cname);
}
} }
return str; return str;
} }
......
...@@ -353,7 +353,7 @@ assert('Exception 19') do ...@@ -353,7 +353,7 @@ assert('Exception 19') do
end end
assert('Exception#inspect without message') do assert('Exception#inspect without message') do
assert_equal "Exception: Exception", Exception.new.inspect assert_equal "Exception", Exception.new.inspect
end end
assert('Exception#backtrace') do assert('Exception#backtrace') do
......
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