diff options
Diffstat (limited to 'conformance/conformance_ruby.rb')
-rwxr-xr-x | conformance/conformance_ruby.rb | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/conformance/conformance_ruby.rb b/conformance/conformance_ruby.rb index aa572144..df63bf7c 100755 --- a/conformance/conformance_ruby.rb +++ b/conformance/conformance_ruby.rb @@ -31,28 +31,37 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. require 'conformance_pb' +require 'google/protobuf/test_messages_proto3_pb' $test_count = 0 $verbose = false def do_test(request) - test_message = Conformance::TestAllTypes.new + test_message = ProtobufTestMessages::Proto3::TestAllTypesProto3.new response = Conformance::ConformanceResponse.new begin case request.payload when :protobuf_payload - begin - test_message = - Conformance::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 = Conformance::TestAllTypes.decode_json(request.json_payload) + test_message = ProtobufTestMessages::Proto3::TestAllTypesProto3.decode_json( + request.json_payload) rescue Google::Protobuf::ParseError => err response.parse_error = err.message.encode('utf-8') return response |