diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2017-07-25 11:52:33 -0700 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2017-07-25 11:52:33 -0700 |
commit | 759245a49a00315a41b28da8fe52a2894d4f57ea (patch) | |
tree | 5a0032a1a3619a448d5301da131907ca8449730f /conformance/conformance_ruby.rb | |
parent | 4bff88e0fb2338657a781eeee0c5362a57b57bf3 (diff) | |
download | protobuf-759245a49a00315a41b28da8fe52a2894d4f57ea.tar.gz protobuf-759245a49a00315a41b28da8fe52a2894d4f57ea.tar.bz2 protobuf-759245a49a00315a41b28da8fe52a2894d4f57ea.zip |
Merge from master
Diffstat (limited to 'conformance/conformance_ruby.rb')
-rwxr-xr-x | conformance/conformance_ruby.rb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/conformance/conformance_ruby.rb b/conformance/conformance_ruby.rb index b7b7cf1c..df63bf7c 100755 --- a/conformance/conformance_ruby.rb +++ b/conformance/conformance_ruby.rb @@ -37,23 +37,30 @@ $test_count = 0 $verbose = false def do_test(request) - test_message = ProtobufTestMessages::Proto3::TestAllTypes.new + test_message = ProtobufTestMessages::Proto3::TestAllTypesProto3.new response = Conformance::ConformanceResponse.new begin case request.payload when :protobuf_payload - begin - test_message = ProtobufTestMessages::Proto3::TestAllTypes.decode( - request.protobuf_payload) - rescue Google::Protobuf::ParseError => err - response.parse_error = err.message.encode('utf-8') + if request.message_type.eql?('protobuf_test_messages.proto3.TestAllTypesProto3') + begin + test_message = ProtobufTestMessages::Proto3::TestAllTypesProto3.decode( + request.protobuf_payload) + rescue Google::Protobuf::ParseError => err + response.parse_error = err.message.encode('utf-8') + return response + end + elsif request.message_type.eql?('protobuf_test_messages.proto2.TestAllTypesProto2') + response.skipped = "Ruby doesn't support proto2" return response + else + fail "Protobuf request doesn't have specific payload type" end when :json_payload begin - test_message = ProtobufTestMessages::Proto3::TestAllTypes.decode_json( + test_message = ProtobufTestMessages::Proto3::TestAllTypesProto3.decode_json( request.json_payload) rescue Google::Protobuf::ParseError => err response.parse_error = err.message.encode('utf-8') |