Skip to content

Commit

Permalink
Add test for json_name functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
lfittl committed Apr 4, 2021
1 parent 07f263c commit 93c703e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ruby/tests/encode_decode_test.rb
Expand Up @@ -95,4 +95,10 @@ def test_encode_wrong_msg
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
4 changes: 4 additions & 0 deletions ruby/tests/generated_code.proto
Expand Up @@ -83,3 +83,7 @@ message TestUnknown {
map<string, TestUnknown> map_unknown = 67;
int32 unknown_field = 89;
}

message TestJsonName {
int32 value = 1 [json_name = "CustomJsonName"];
}

0 comments on commit 93c703e

Please sign in to comment.