Add test for json_name functionality

pull/8356/head
Lukas Fittl 4 years ago
parent 07f263c7ef
commit 93c703e816
  1. 6
      ruby/tests/encode_decode_test.rb
  2. 4
      ruby/tests/generated_code.proto

@ -95,4 +95,10 @@ class EncodeDecodeTest < Test::Unit::TestCase
end end
end end
def test_json_name
msg = A::B::C::TestJsonName.new(:value => 42)
json = msg.to_json
assert_match json, "{\"CustomJsonName\":42}"
end
end end

@ -83,3 +83,7 @@ message TestUnknown {
map<string, TestUnknown> map_unknown = 67; map<string, TestUnknown> map_unknown = 67;
int32 unknown_field = 89; int32 unknown_field = 89;
} }
message TestJsonName {
int32 value = 1 [json_name = "CustomJsonName"];
}

Loading…
Cancel
Save