diff --git a/mrbgems/mruby-bin-debugger/bintest/print.rb b/mrbgems/mruby-bin-debugger/bintest/print.rb index 63ebded3e..c475cf688 100644 --- a/mrbgems/mruby-bin-debugger/bintest/print.rb +++ b/mrbgems/mruby-bin-debugger/bintest/print.rb @@ -433,11 +433,11 @@ SRC tc << {:cmd=>"s"} tc << {:cmd=>'p {}', :exp=>'$1 = {}'} - tc << {:cmd=>'p {"one"=>1,"two"=>2}', :exp=>'$2 = {"one"=>1, "two"=>2}'} - tc << {:cmd=>'p {:eins=>"1", :zwei=>"2", }', :exp=>'$3 = {:eins=>"1", :zwei=>"2"}'} - tc << {:cmd=>'p {uno:"one", dos: 2}', :exp=>'$4 = {:uno=>"one", :dos=>2}'} - tc << {:cmd=>'p {"one"=>1, :zwei=>2, tres:3}', :exp=>'$5 = {"one"=>1, :zwei=>2, :tres=>3}'} - tc << {:cmd=>'p {:foo=>"#{foo}",:bar=>"#{bar}"}', :exp=>'$6 = {:foo=>"foo", :bar=>"bar"}'} + tc << {:cmd=>'p {"one"=>1,"two"=>2}', :exp=>'$2 = {"one" => 1, "two" => 2}'} + tc << {:cmd=>'p {:eins=>"1", :zwei=>"2",}', :exp=>'$3 = {:eins => "1", :zwei => "2"}'} + tc << {:cmd=>'p {uno:"one", dos: 2}', :exp=>'$4 = {:uno => "one", :dos => 2}'} + tc << {:cmd=>'p {"one"=>1, :zwei=>2, tres:3}', :exp=>'$5 = {"one" => 1, :zwei => 2, :tres => 3}'} + tc << {:cmd=>'p {:foo=>"#{foo}",:bar=>"#{bar}"}', :exp=>'$6 = {:foo => "foo", :bar => "bar"}'} BinTest_MrubyBinDebugger.test(src, tc) end diff --git a/src/hash.c b/src/hash.c index 29d5b3b7b..5dd5cf522 100644 --- a/src/hash.c +++ b/src/hash.c @@ -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)); }); diff --git a/test/t/array.rb b/test/t/array.rb index 34b8aacbd..240aeb86e 100644 --- a/test/t/array.rb +++ b/test/t/array.rb @@ -33,7 +33,7 @@ assert('Array#*', '15.2.12.5.2') do assert_equal([1, 1, 1], [1].*(3)) assert_equal([], [1].*(0)) assert_equal('abc', ['a', 'b', 'c'].*('')) - assert_equal('0, 0, 1, {:foo=>0}', [0, [0, 1], {foo: 0}].*(', ')) + assert_equal('0, 0, 1, {:foo => 0}', [0, [0, 1], {foo: 0}].*(', ')) end assert('Array#<<', '15.2.12.5.3') do diff --git a/test/t/hash.rb b/test/t/hash.rb index 3fbc5cd9c..17342433e 100644 --- a/test/t/hash.rb +++ b/test/t/hash.rb @@ -860,13 +860,13 @@ end h1 = {:s => 0, :a => [1,2], 37 => :b, :d => "del", "c" => nil} h1.shift h1.delete(:d) - s1 = ':a=>[1, 2], 37=>:b, "c"=>nil' + s1 = ':a => [1, 2], 37 => :b, "c" => nil' h2 = Hash.new(100) (1..14).each{h2[_1] = _1 * 2} h2 = {**h2, **h1} - s2 = "1=>2, 2=>4, 3=>6, 4=>8, 5=>10, 6=>12, 7=>14, 8=>16, " \ - "9=>18, 10=>20, 11=>22, 12=>24, 13=>26, 14=>28, #{s1}" + s2 = "1 => 2, 2 => 4, 3 => 6, 4 => 8, 5 => 10, 6 => 12, 7 => 14, 8 => 16, " \ + "9 => 18, 10 => 20, 11 => 22, 12 => 24, 13 => 26, 14 => 28, #{s1}" [[h1, s1], [h2, s2]].each do |h, s| assert_equal("{#{s}}", h.__send__(meth)) @@ -874,11 +874,11 @@ end hh = {} hh[:recur] = hh h.each{|k, v| hh[k] = v} - assert_equal("{:recur=>{...}, #{s}}", hh.__send__(meth)) + assert_equal("{:recur => {...}, #{s}}", hh.__send__(meth)) hh = h.dup hh[hh] = :recur - assert_equal("{#{s}, {...}=>:recur}", hh.__send__(meth)) + assert_equal("{#{s}, {...} => :recur}", hh.__send__(meth)) end end end diff --git a/test/t/literals.rb b/test/t/literals.rb index f93968650..54bcbc716 100644 --- a/test/t/literals.rb +++ b/test/t/literals.rb @@ -233,7 +233,7 @@ ZZZ assert_equal " iii\n", i assert_equal [" j1j\n", " j2j\n", " j\#{3}j\n"], j assert_equal 123, k - assert_equal ["x{:x=>\"mm3\\n\"}y\nmm1\n", "mm2\n"], m + assert_equal ["x{:x => \"mm3\\n\"}y\nmm1\n", "mm2\n"], m assert_equal ({:x=>"mm3\n"}), m2 assert_equal [1, "nn1\n", 3, 4], n assert_equal "a $ q\n $ c $ d", q1 diff --git a/test/t/vformat.rb b/test/t/vformat.rb index f645351ee..f87d4d7b8 100644 --- a/test/t/vformat.rb +++ b/test/t/vformat.rb @@ -1,4 +1,3 @@ -# coding: utf-8-emacs def sclass(v) class << v self @@ -22,7 +21,7 @@ assert('mrb_vformat') do assert_match '#>>', vf.v('%t', sclass({})) assert_equal 'string and length', vf.l('string %l length', 'andante', 3) assert_equal '`n`: sym', vf.n('`n`: %n', :sym) - assert_equal '%C文字列õ€•º%', vf.s('%s', '%C文字列õ€•º%') + assert_equal '%Cʸ»úÎó¯÷%', vf.s('%s', '%Cʸ»úÎó¯÷%') assert_equal '`C`: Kernel module', vf.C('`C`: %C module', Kernel) assert_equal '`C`: NilClass', vf.C('`C`: %C', nil.class) assert_match '#>', vf.C('%C', sclass("")) @@ -40,7 +39,7 @@ assert('mrb_vformat') do assert_equal 'Class', vf.v('%Y', sclass({})) assert_match '#>', vf.v('%v', sclass("")) assert_equal '`v`: 1...3', vf.v('`v`: %v', 1...3) - assert_equal '`S`: {:a=>1, "b"=>"c"}', vf.v('`S`: %S', {a: 1, "b" => ?c}) + assert_equal '`S`: {:a => 1, "b" => "c"}', vf.v('`S`: %S', {a: 1, "b" => ?c}) assert_equal 'percent: %', vf.z('percent: %%') assert_equal '"I": inspect char', vf.c('%!c: inspect char', ?I) assert_equal '709: inspect mrb_int', vf.i('%!d: inspect mrb_int', 709)