diff options
author | Josh Haberman <jhaberman@gmail.com> | 2016-01-13 19:05:43 -0800 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2016-02-18 10:50:14 -0800 |
commit | 78da66698b2f4b1f2530be855cf2509dd58737ca (patch) | |
tree | 81312c23b34f1ba2114810d7a8ad2bebe3d289d4 /conformance/conformance_ruby.rb | |
parent | c40f8c1f54f028b1ca73f3fb2dfdde500f94918f (diff) | |
download | protobuf-78da66698b2f4b1f2530be855cf2509dd58737ca.tar.gz protobuf-78da66698b2f4b1f2530be855cf2509dd58737ca.tar.bz2 protobuf-78da66698b2f4b1f2530be855cf2509dd58737ca.zip |
Changed Ruby to properly camelCase its JSON by default.
Diffstat (limited to 'conformance/conformance_ruby.rb')
-rwxr-xr-x | conformance/conformance_ruby.rb | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/conformance/conformance_ruby.rb b/conformance/conformance_ruby.rb index cd065673..c716facd 100755 --- a/conformance/conformance_ruby.rb +++ b/conformance/conformance_ruby.rb @@ -51,7 +51,12 @@ def do_test(request) end when :json_payload - test_message = Conformance::TestAllTypes.decode_json(request.json_payload) + begin + test_message = Conformance::TestAllTypes.decode_json(request.json_payload) + rescue Google::Protobuf::ParseError => err + response.parse_error = err.message.encode('utf-8') + return response + end when nil fail "Request didn't have payload" @@ -66,6 +71,9 @@ def do_test(request) when :JSON response.json_payload = test_message.to_json + + when nil + fail "Request didn't have requested output format" end rescue StandardError => err response.runtime_error = err.message.encode('utf-8') @@ -96,8 +104,8 @@ def do_test_io STDOUT.flush if $verbose - STDERR.puts("conformance-cpp: request={request.to_json}, " \ - "response={response.to_json}\n") + STDERR.puts("conformance_ruby: request=#{request.to_json}, " \ + "response=#{response.to_json}\n") end $test_count += 1 @@ -107,7 +115,7 @@ end loop do unless do_test_io - STDERR.puts('conformance-cpp: received EOF from test runner ' \ + STDERR.puts('conformance_ruby: received EOF from test runner ' \ "after #{$test_count} tests, exiting") break end |