浏览代码

Merge pull request #211 from isaiah/map_inspect

Ruby implementation Map#inspect should be consistent with Hash#inspect
Chris Fallin 10 年之前
父节点
当前提交
db87a9c07a
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      ruby/ext/google/protobuf_c/map.c
  2. 1 1
      ruby/tests/basic.rb

+ 1 - 1
ruby/ext/google/protobuf_c/map.c

@@ -683,7 +683,7 @@ VALUE Map_inspect(VALUE _self) {
       first = false;
       first = false;
     }
     }
     str = rb_str_append(str, rb_funcall(key, inspect_sym, 0));
     str = rb_str_append(str, rb_funcall(key, inspect_sym, 0));
-    str = rb_str_cat2(str, " => ");
+    str = rb_str_cat2(str, "=>");
     str = rb_str_append(str, rb_funcall(value, inspect_sym, 0));
     str = rb_str_append(str, rb_funcall(value, inspect_sym, 0));
   }
   }
 
 

+ 1 - 1
ruby/tests/basic.rb

@@ -391,7 +391,7 @@ module BasicTest
       # We only assert on inspect value when there is one map entry because the
       # We only assert on inspect value when there is one map entry because the
       # order in which elements appear is unspecified (depends on the internal
       # order in which elements appear is unspecified (depends on the internal
       # hash function). We don't want a brittle test.
       # hash function). We don't want a brittle test.
-      assert m.inspect == "{\"jkl;\" => 42}"
+      assert m.inspect == "{\"jkl;\"=>42}"
 
 
       assert m.keys == ["jkl;"]
       assert m.keys == ["jkl;"]
       assert m.values == [42]
       assert m.values == [42]