aboutsummaryrefslogtreecommitdiffhomepage
path: root/ruby/tests
diff options
context:
space:
mode:
authorGravatar Ewout <e@ewout.name>2018-02-20 16:58:58 +0100
committerGravatar Ewout <e@ewout.name>2018-02-20 17:13:21 +0100
commit7b8f571756792ed2296a766c70af4ddf69082099 (patch)
treed53cd8664d01d386babc863ff2d2fc62d93a1570 /ruby/tests
parente34ec6077af141dd5dfc1c334ecdcce3c6b51612 (diff)
Ruby JSON encoding omits zero-length repeated fields by default.
This makes it behave the same way as the other implementations. It is also nice to always encode an empty message as {}.
Diffstat (limited to 'ruby/tests')
-rw-r--r--ruby/tests/basic.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb
index ad34d53d..cadb1380 100644
--- a/ruby/tests/basic.rb
+++ b/ruby/tests/basic.rb
@@ -1259,6 +1259,10 @@ module BasicTest
Foo.encode_json(Foo.new(bar: bar, baz: [baz1, baz2]))
end
+ def test_json_empty
+ assert TestMessage.encode_json(TestMessage.new) == '{}'
+ end
+
def test_json_emit_defaults
# TODO: Fix JSON in JRuby version.
return if RUBY_PLATFORM == "java"