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

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

Issue 2590803003: Revert "third_party/protobuf: Update to HEAD (83d681ee2c)" (Closed)
Patch Set: Created 4 years 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 12 matching lines...) Expand all
23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 32
33 require 'conformance_pb' 33 require 'conformance'
34 require 'google/protobuf/test_messages_proto3_pb'
35 34
36 $test_count = 0 35 $test_count = 0
37 $verbose = false 36 $verbose = false
38 37
39 def do_test(request) 38 def do_test(request)
40 test_message = ProtobufTestMessages::Proto3::TestAllTypes.new 39 test_message = Conformance::TestAllTypes.new
41 response = Conformance::ConformanceResponse.new 40 response = Conformance::ConformanceResponse.new
42 41
43 begin 42 begin
44 case request.payload 43 case request.payload
45 when :protobuf_payload 44 when :protobuf_payload
46 begin 45 begin
47 test_message = ProtobufTestMessages::Proto3::TestAllTypes.decode( 46 test_message =
48 request.protobuf_payload) 47 Conformance::TestAllTypes.decode(request.protobuf_payload)
49 rescue Google::Protobuf::ParseError => err 48 rescue Google::Protobuf::ParseError => err
50 response.parse_error = err.message.encode('utf-8') 49 response.parse_error = err.message.encode('utf-8')
51 return response 50 return response
52 end 51 end
53 52
54 when :json_payload 53 when :json_payload
55 begin 54 begin
56 test_message = ProtobufTestMessages::Proto3::TestAllTypes.decode_json( 55 test_message = Conformance::TestAllTypes.decode_json(request.json_payloa d)
57 request.json_payload)
58 rescue Google::Protobuf::ParseError => err 56 rescue Google::Protobuf::ParseError => err
59 response.parse_error = err.message.encode('utf-8') 57 response.parse_error = err.message.encode('utf-8')
60 return response 58 return response
61 end 59 end
62 60
63 when nil 61 when nil
64 fail "Request didn't have payload" 62 fail "Request didn't have payload"
65 end 63 end
66 64
67 case request.requested_output_format 65 case request.requested_output_format
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 true 113 true
116 end 114 end
117 115
118 loop do 116 loop do
119 unless do_test_io 117 unless do_test_io
120 STDERR.puts('conformance_ruby: received EOF from test runner ' \ 118 STDERR.puts('conformance_ruby: received EOF from test runner ' \
121 "after #{$test_count} tests, exiting") 119 "after #{$test_count} tests, exiting")
122 break 120 break
123 end 121 end
124 end 122 end
OLDNEW
« no previous file with comments | « third_party/protobuf/conformance/conformance_python.py ('k') | third_party/protobuf/conformance/conformance_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698