hash.c (mrb_hash_to_s): put spaces around =>

CRuby 3.4 puts spaces around `=>` since for example `{:a!=>2}` can be
confusing where to separate tokens.  mruby should follow the behavior.

Many tests in `test/t` directory assumed no spaces around `=>`, so we
needed to fix them too.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2024-11-09 18:45:06 +09:00
parent d2eb2bcacc
commit 5387b74be7
6 changed files with 15 additions and 16 deletions
+1 -1
View File
@@ -1843,7 +1843,7 @@ mrb_hash_to_s(mrb_state *mrb, mrb_value self)
mrb_str_cat_str(mrb, ret, mrb_inspect(mrb, entry->key));
});
mrb_gc_arena_restore(mrb, ai);
mrb_str_cat_lit(mrb, ret, "=>");
mrb_str_cat_lit(mrb, ret, " => ");
h_check_modified(mrb, h, {
mrb_str_cat_str(mrb, ret, mrb_inspect(mrb, entry->val));
});