aboutsummaryrefslogtreecommitdiff
path: root/ruby/tests/basic.rb
diff options
context:
space:
mode:
authorChris Fallin <cfallin@google.com>2015-02-02 15:07:34 -0800
committerChris Fallin <cfallin@google.com>2015-02-02 15:07:34 -0800
commita50759254fa9beb1369c2cc527ae576993a63be8 (patch)
tree37bb711122fc263797131c1544f2c0fc7b1dc429 /ruby/tests/basic.rb
parent17e4419188e5873c43d462d493fcbb2cc668aa71 (diff)
downloadprotobuf-a50759254fa9beb1369c2cc527ae576993a63be8.tar.gz
protobuf-a50759254fa9beb1369c2cc527ae576993a63be8.tar.bz2
protobuf-a50759254fa9beb1369c2cc527ae576993a63be8.zip
Updated to latest upb and added test for JSON map operation.
Diffstat (limited to 'ruby/tests/basic.rb')
-rw-r--r--ruby/tests/basic.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb
index 1b7508bb..ca4c4ebe 100644
--- a/ruby/tests/basic.rb
+++ b/ruby/tests/basic.rb
@@ -991,5 +991,13 @@ module BasicTest
m2 = TestMessage.decode_json(json_text)
assert m == m2
end
+
+ def test_json_maps
+ m = MapMessage.new(:map_string_int32 => {"a" => 1})
+ expected = '{"map_string_int32":{"a":1},"map_string_msg":{}}'
+ assert MapMessage.encode_json(m) == expected
+ m2 = MapMessage.decode_json(MapMessage.encode_json(m))
+ assert m == m2
+ end
end
end