Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: third_party/protobuf/conformance/conformance_ruby.rb

Issue 1983203003: Update third_party/protobuf to protobuf-v3.0.0-beta-3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: owners Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/env ruby 1 #!/usr/bin/env ruby
2 # 2 #
3 # Protocol Buffers - Google's data interchange format 3 # Protocol Buffers - Google's data interchange format
4 # Copyright 2008 Google Inc. All rights reserved. 4 # Copyright 2008 Google Inc. All rights reserved.
5 # https://developers.google.com/protocol-buffers/ 5 # https://developers.google.com/protocol-buffers/
6 # 6 #
7 # Redistribution and use in source and binary forms, with or without 7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions are 8 # modification, are permitted provided that the following conditions are
9 # met: 9 # met:
10 # 10 #
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 when :protobuf_payload 44 when :protobuf_payload
45 begin 45 begin
46 test_message = 46 test_message =
47 Conformance::TestAllTypes.decode(request.protobuf_payload) 47 Conformance::TestAllTypes.decode(request.protobuf_payload)
48 rescue Google::Protobuf::ParseError => err 48 rescue Google::Protobuf::ParseError => err
49 response.parse_error = err.message.encode('utf-8') 49 response.parse_error = err.message.encode('utf-8')
50 return response 50 return response
51 end 51 end
52 52
53 when :json_payload 53 when :json_payload
54 test_message = Conformance::TestAllTypes.decode_json(request.json_payload) 54 begin
55 test_message = Conformance::TestAllTypes.decode_json(request.json_payloa d)
56 rescue Google::Protobuf::ParseError => err
57 response.parse_error = err.message.encode('utf-8')
58 return response
59 end
55 60
56 when nil 61 when nil
57 fail "Request didn't have payload" 62 fail "Request didn't have payload"
58 end 63 end
59 64
60 case request.requested_output_format 65 case request.requested_output_format
61 when :UNSPECIFIED 66 when :UNSPECIFIED
62 fail 'Unspecified output format' 67 fail 'Unspecified output format'
63 68
64 when :PROTOBUF 69 when :PROTOBUF
65 response.protobuf_payload = test_message.to_proto 70 response.protobuf_payload = test_message.to_proto
66 71
67 when :JSON 72 when :JSON
68 response.json_payload = test_message.to_json 73 response.json_payload = test_message.to_json
74
75 when nil
76 fail "Request didn't have requested output format"
69 end 77 end
70 rescue StandardError => err 78 rescue StandardError => err
71 response.runtime_error = err.message.encode('utf-8') 79 response.runtime_error = err.message.encode('utf-8')
72 end 80 end
73 81
74 response 82 response
75 end 83 end
76 84
77 # Returns true if the test ran successfully, false on legitimate EOF. 85 # Returns true if the test ran successfully, false on legitimate EOF.
78 # If EOF is encountered in an unexpected place, raises IOError. 86 # If EOF is encountered in an unexpected place, raises IOError.
(...skipping 10 matching lines...) Expand all
89 request = Conformance::ConformanceRequest.decode(serialized_request) 97 request = Conformance::ConformanceRequest.decode(serialized_request)
90 98
91 response = do_test(request) 99 response = do_test(request)
92 100
93 serialized_response = Conformance::ConformanceResponse.encode(response) 101 serialized_response = Conformance::ConformanceResponse.encode(response)
94 STDOUT.write([serialized_response.length].pack('V')) 102 STDOUT.write([serialized_response.length].pack('V'))
95 STDOUT.write(serialized_response) 103 STDOUT.write(serialized_response)
96 STDOUT.flush 104 STDOUT.flush
97 105
98 if $verbose 106 if $verbose
99 STDERR.puts("conformance-cpp: request={request.to_json}, " \ 107 STDERR.puts("conformance_ruby: request=#{request.to_json}, " \
100 "response={response.to_json}\n") 108 "response=#{response.to_json}\n")
101 end 109 end
102 110
103 $test_count += 1 111 $test_count += 1
104 112
105 true 113 true
106 end 114 end
107 115
108 loop do 116 loop do
109 unless do_test_io 117 unless do_test_io
110 STDERR.puts('conformance-cpp: received EOF from test runner ' \ 118 STDERR.puts('conformance_ruby: received EOF from test runner ' \
111 "after #{$test_count} tests, exiting") 119 "after #{$test_count} tests, exiting")
112 break 120 break
113 end 121 end
114 end 122 end
OLDNEW
« no previous file with comments | « third_party/protobuf/conformance/conformance_objc.m ('k') | third_party/protobuf/conformance/conformance_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698