cucumber-messages 2.1.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14d4d620416f484e12073801f1236a79a17a892a64d45741a03ad12489501469
4
- data.tar.gz: b52b0172e5ba920d9c3473106ae7c530b822c46f2cb99e109d5e857b4a455e9b
3
+ metadata.gz: ec581d89124a64d53e9ee2e688839f0a223488cbda81cd4e05f1046d3407a9ae
4
+ data.tar.gz: 425def64d4aef46d8fc04393089b9345c3f07f7e70437ff0c9d7a0eff88fda24
5
5
  SHA512:
6
- metadata.gz: d691a40865dd2d9dbfd5091d9c6d220fbddf3aca37690b27888fe4f46d5e8f243212feea953ac6b4a3dcf2a3dc4433374389554ca2e28966472aef323f1e47d7
7
- data.tar.gz: be6c763cb048361cdeb88dae28ec55d97a85742b04314fbdb31fa6b7ba411eb0c18dee566268b0a0ec85b0f82cbc8207441c1de7225631ba35083dfaeab70583
6
+ metadata.gz: b0479a526c037b51d7ffad1963eced6e867308402dba59c7b00e03aed335e142b952db992858a71cb0e7ae78405ae798977e0e95c5c874d3e031ae89589c5362
7
+ data.tar.gz: 0ba93216454fabbe04ccf57bb32b6db3fd6d0541c797ddce8d6db3cdef75357252fe690202ac5387dce82406b351399ef51e7539ec026c380cf79e380143b057
@@ -1,36 +1,6 @@
1
1
  require 'cucumber/messages_pb'
2
+ require 'cucumber/messages/protobuf_io_enumerator'
3
+ require 'cucumber/messages/protobuf_delimited'
2
4
 
3
- module Cucumber
4
- module Messages
5
- module Varint
6
- def decode_varint(io)
7
- # https://github.com/ruby-protobuf/protobuf/blob/master/lib/protobuf/varint_pure.rb
8
- value = index = 0
9
- begin
10
- byte = io.readbyte
11
- value |= (byte & 0x7f) << (7 * index)
12
- index += 1
13
- end while (byte & 0x80).nonzero?
14
- value
15
- end
16
-
17
- # https://www.rubydoc.info/gems/ruby-protocol-buffers/1.2.2/ProtocolBuffers%2FVarint.encode
18
- def encode_varint(io, int_val)
19
- if int_val < 0
20
- # negative varints are always encoded with the full 10 bytes
21
- int_val = int_val & 0xffffffff_ffffffff
22
- end
23
- loop do
24
- byte = int_val & 0x7f
25
- int_val >>= 7
26
- if int_val == 0
27
- io << byte.chr
28
- break
29
- else
30
- io << (byte | 0x80).chr
31
- end
32
- end
33
- end
34
- end
35
- end
36
- end
5
+ Cucumber::Messages::Envelope.include(Cucumber::Messages::WriteDelimited)
6
+ Cucumber::Messages::Envelope.extend(Cucumber::Messages::ParseDelimited)
@@ -0,0 +1,21 @@
1
+ require 'cucumber/messages/varint'
2
+
3
+ module Cucumber
4
+ module Messages
5
+ module WriteDelimited
6
+ def write_delimited_to(io)
7
+ proto = self.class.encode(self)
8
+ Varint.encode_varint(io, proto.length)
9
+ io.write(proto)
10
+ end
11
+ end
12
+
13
+ module ParseDelimited
14
+ def parse_delimited_from(io)
15
+ len = Varint.decode_varint(io)
16
+ buf = io.read(len)
17
+ self.decode(buf)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,15 @@
1
+ require 'cucumber/messages/varint'
2
+
3
+ module Cucumber
4
+ module Messages
5
+ module ProtobufIoEnumerator
6
+ def self.call(io)
7
+ Enumerator.new do |yielder|
8
+ while !io.eof?
9
+ yielder.yield(Cucumber::Messages::Envelope.parse_delimited_from(io))
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,37 @@
1
+ module Cucumber
2
+ module Messages
3
+ # Varint (variable byte-length int) is an encoding format commonly used
4
+ # to encode the length of Protocol Buffer message frames.
5
+ module Varint
6
+
7
+ def self.decode_varint(io)
8
+ # https://github.com/ruby-protobuf/protobuf/blob/master/lib/protobuf/varint_pure.rb
9
+ value = index = 0
10
+ begin
11
+ byte = io.readbyte
12
+ value |= (byte & 0x7f) << (7 * index)
13
+ index += 1
14
+ end while (byte & 0x80).nonzero?
15
+ value
16
+ end
17
+
18
+ # https://www.rubydoc.info/gems/ruby-protocol-buffers/1.2.2/ProtocolBuffers%2FVarint.encode
19
+ def self.encode_varint(io, int_val)
20
+ if int_val < 0
21
+ # negative varints are always encoded with the full 10 bytes
22
+ int_val = int_val & 0xffffffff_ffffffff
23
+ end
24
+ loop do
25
+ byte = int_val & 0x7f
26
+ int_val >>= 7
27
+ if int_val == 0
28
+ io << byte.chr
29
+ break
30
+ else
31
+ io << (byte | 0x80).chr
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -5,7 +5,7 @@ require 'google/protobuf'
5
5
 
6
6
  require 'google/protobuf/timestamp_pb'
7
7
  Google::Protobuf::DescriptorPool.generated_pool.build do
8
- add_message "io.cucumber.messages.Wrapper" do
8
+ add_message "io.cucumber.messages.Envelope" do
9
9
  oneof :message do
10
10
  optional :source, :message, 1, "io.cucumber.messages.Source"
11
11
  optional :gherkinDocument, :message, 2, "io.cucumber.messages.GherkinDocument"
@@ -34,23 +34,22 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
34
34
  optional :commandError, :string, 25
35
35
  end
36
36
  end
37
- add_message "io.cucumber.messages.SourceReference" do
38
- optional :uri, :string, 1
39
- optional :location, :message, 2, "io.cucumber.messages.Location"
40
- end
41
37
  add_message "io.cucumber.messages.Location" do
42
38
  optional :line, :uint32, 1
43
39
  optional :column, :uint32, 2
44
40
  end
45
- add_message "io.cucumber.messages.Attachment" do
46
- optional :source, :message, 1, "io.cucumber.messages.SourceReference"
47
- optional :data, :string, 2
48
- optional :media, :message, 3, "io.cucumber.messages.Media"
41
+ add_message "io.cucumber.messages.SourceReference" do
42
+ optional :uri, :string, 1
43
+ optional :location, :message, 2, "io.cucumber.messages.Location"
49
44
  end
50
45
  add_message "io.cucumber.messages.Media" do
51
- optional :encoding, :string, 1
46
+ optional :encoding, :enum, 1, "io.cucumber.messages.Media.Encoding"
52
47
  optional :content_type, :string, 2
53
48
  end
49
+ add_enum "io.cucumber.messages.Media.Encoding" do
50
+ value :BASE64, 0
51
+ value :UTF8, 1
52
+ end
54
53
  add_message "io.cucumber.messages.Source" do
55
54
  optional :uri, :string, 1
56
55
  optional :data, :string, 2
@@ -58,133 +57,141 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
58
57
  end
59
58
  add_message "io.cucumber.messages.GherkinDocument" do
60
59
  optional :uri, :string, 1
61
- optional :feature, :message, 2, "io.cucumber.messages.Feature"
62
- repeated :comments, :message, 3, "io.cucumber.messages.Comment"
60
+ optional :feature, :message, 2, "io.cucumber.messages.GherkinDocument.Feature"
61
+ repeated :comments, :message, 3, "io.cucumber.messages.GherkinDocument.Comment"
62
+ end
63
+ add_message "io.cucumber.messages.GherkinDocument.Comment" do
64
+ optional :location, :message, 1, "io.cucumber.messages.Location"
65
+ optional :text, :string, 2
63
66
  end
64
- add_message "io.cucumber.messages.Feature" do
67
+ add_message "io.cucumber.messages.GherkinDocument.Feature" do
65
68
  optional :location, :message, 1, "io.cucumber.messages.Location"
66
- repeated :tags, :message, 2, "io.cucumber.messages.Tag"
69
+ repeated :tags, :message, 2, "io.cucumber.messages.GherkinDocument.Feature.Tag"
67
70
  optional :language, :string, 3
68
71
  optional :keyword, :string, 4
69
72
  optional :name, :string, 5
70
73
  optional :description, :string, 6
71
- repeated :children, :message, 7, "io.cucumber.messages.FeatureChild"
74
+ repeated :children, :message, 7, "io.cucumber.messages.GherkinDocument.Feature.FeatureChild"
72
75
  end
73
- add_message "io.cucumber.messages.FeatureChild" do
76
+ add_message "io.cucumber.messages.GherkinDocument.Feature.Tag" do
77
+ optional :location, :message, 1, "io.cucumber.messages.Location"
78
+ optional :name, :string, 2
79
+ end
80
+ add_message "io.cucumber.messages.GherkinDocument.Feature.FeatureChild" do
74
81
  oneof :value do
75
- optional :rule, :message, 1, "io.cucumber.messages.Rule"
76
- optional :background, :message, 2, "io.cucumber.messages.Background"
77
- optional :scenario, :message, 3, "io.cucumber.messages.Scenario"
82
+ optional :rule, :message, 1, "io.cucumber.messages.GherkinDocument.Feature.FeatureChild.Rule"
83
+ optional :background, :message, 2, "io.cucumber.messages.GherkinDocument.Feature.Background"
84
+ optional :scenario, :message, 3, "io.cucumber.messages.GherkinDocument.Feature.Scenario"
78
85
  end
79
86
  end
80
- add_message "io.cucumber.messages.Rule" do
87
+ add_message "io.cucumber.messages.GherkinDocument.Feature.FeatureChild.Rule" do
81
88
  optional :location, :message, 1, "io.cucumber.messages.Location"
82
89
  optional :keyword, :string, 2
83
90
  optional :name, :string, 3
84
91
  optional :description, :string, 4
85
- repeated :children, :message, 5, "io.cucumber.messages.RuleChild"
92
+ repeated :children, :message, 5, "io.cucumber.messages.GherkinDocument.Feature.FeatureChild.RuleChild"
86
93
  end
87
- add_message "io.cucumber.messages.RuleChild" do
94
+ add_message "io.cucumber.messages.GherkinDocument.Feature.FeatureChild.RuleChild" do
88
95
  oneof :value do
89
- optional :background, :message, 1, "io.cucumber.messages.Background"
90
- optional :scenario, :message, 2, "io.cucumber.messages.Scenario"
96
+ optional :background, :message, 1, "io.cucumber.messages.GherkinDocument.Feature.Background"
97
+ optional :scenario, :message, 2, "io.cucumber.messages.GherkinDocument.Feature.Scenario"
91
98
  end
92
99
  end
93
- add_message "io.cucumber.messages.Background" do
100
+ add_message "io.cucumber.messages.GherkinDocument.Feature.Background" do
94
101
  optional :location, :message, 1, "io.cucumber.messages.Location"
95
102
  optional :keyword, :string, 2
96
103
  optional :name, :string, 3
97
104
  optional :description, :string, 4
98
- repeated :steps, :message, 5, "io.cucumber.messages.Step"
105
+ repeated :steps, :message, 5, "io.cucumber.messages.GherkinDocument.Feature.Step"
99
106
  end
100
- add_message "io.cucumber.messages.Scenario" do
107
+ add_message "io.cucumber.messages.GherkinDocument.Feature.Scenario" do
101
108
  optional :location, :message, 1, "io.cucumber.messages.Location"
102
- repeated :tags, :message, 2, "io.cucumber.messages.Tag"
109
+ repeated :tags, :message, 2, "io.cucumber.messages.GherkinDocument.Feature.Tag"
103
110
  optional :keyword, :string, 3
104
111
  optional :name, :string, 4
105
112
  optional :description, :string, 5
106
- repeated :steps, :message, 6, "io.cucumber.messages.Step"
107
- repeated :examples, :message, 7, "io.cucumber.messages.Examples"
113
+ repeated :steps, :message, 6, "io.cucumber.messages.GherkinDocument.Feature.Step"
114
+ repeated :examples, :message, 7, "io.cucumber.messages.GherkinDocument.Feature.Scenario.Examples"
108
115
  end
109
- add_message "io.cucumber.messages.Comment" do
116
+ add_message "io.cucumber.messages.GherkinDocument.Feature.Scenario.Examples" do
110
117
  optional :location, :message, 1, "io.cucumber.messages.Location"
111
- optional :text, :string, 2
118
+ repeated :tags, :message, 2, "io.cucumber.messages.GherkinDocument.Feature.Tag"
119
+ optional :keyword, :string, 3
120
+ optional :name, :string, 4
121
+ optional :description, :string, 5
122
+ optional :table_header, :message, 6, "io.cucumber.messages.GherkinDocument.Feature.TableRow"
123
+ repeated :table_body, :message, 7, "io.cucumber.messages.GherkinDocument.Feature.TableRow"
112
124
  end
113
- add_message "io.cucumber.messages.DataTable" do
125
+ add_message "io.cucumber.messages.GherkinDocument.Feature.TableRow" do
114
126
  optional :location, :message, 1, "io.cucumber.messages.Location"
115
- repeated :rows, :message, 2, "io.cucumber.messages.TableRow"
127
+ repeated :cells, :message, 2, "io.cucumber.messages.GherkinDocument.Feature.TableRow.TableCell"
116
128
  end
117
- add_message "io.cucumber.messages.DocString" do
129
+ add_message "io.cucumber.messages.GherkinDocument.Feature.TableRow.TableCell" do
118
130
  optional :location, :message, 1, "io.cucumber.messages.Location"
119
- optional :content_type, :string, 2
120
- optional :content, :string, 3
121
- optional :delimiter, :string, 4
122
- end
123
- add_message "io.cucumber.messages.Examples" do
124
- optional :location, :message, 1, "io.cucumber.messages.Location"
125
- repeated :tags, :message, 2, "io.cucumber.messages.Tag"
126
- optional :keyword, :string, 3
127
- optional :name, :string, 4
128
- optional :description, :string, 5
129
- optional :table_header, :message, 6, "io.cucumber.messages.TableRow"
130
- repeated :table_body, :message, 7, "io.cucumber.messages.TableRow"
131
+ optional :value, :string, 2
131
132
  end
132
- add_message "io.cucumber.messages.Step" do
133
+ add_message "io.cucumber.messages.GherkinDocument.Feature.Step" do
133
134
  optional :location, :message, 1, "io.cucumber.messages.Location"
134
135
  optional :keyword, :string, 2
135
136
  optional :text, :string, 3
136
137
  oneof :argument do
137
- optional :doc_string, :message, 5, "io.cucumber.messages.DocString"
138
- optional :data_table, :message, 6, "io.cucumber.messages.DataTable"
138
+ optional :doc_string, :message, 5, "io.cucumber.messages.GherkinDocument.Feature.Step.DocString"
139
+ optional :data_table, :message, 6, "io.cucumber.messages.GherkinDocument.Feature.Step.DataTable"
139
140
  end
140
141
  end
141
- add_message "io.cucumber.messages.TableCell" do
142
+ add_message "io.cucumber.messages.GherkinDocument.Feature.Step.DataTable" do
142
143
  optional :location, :message, 1, "io.cucumber.messages.Location"
143
- optional :value, :string, 2
144
+ repeated :rows, :message, 2, "io.cucumber.messages.GherkinDocument.Feature.TableRow"
144
145
  end
145
- add_message "io.cucumber.messages.TableRow" do
146
+ add_message "io.cucumber.messages.GherkinDocument.Feature.Step.DocString" do
146
147
  optional :location, :message, 1, "io.cucumber.messages.Location"
147
- repeated :cells, :message, 2, "io.cucumber.messages.TableCell"
148
+ optional :content_type, :string, 2
149
+ optional :content, :string, 3
150
+ optional :delimiter, :string, 4
148
151
  end
149
- add_message "io.cucumber.messages.Tag" do
150
- optional :location, :message, 1, "io.cucumber.messages.Location"
151
- optional :name, :string, 2
152
+ add_message "io.cucumber.messages.Attachment" do
153
+ optional :source, :message, 1, "io.cucumber.messages.SourceReference"
154
+ optional :data, :string, 2
155
+ optional :media, :message, 3, "io.cucumber.messages.Media"
152
156
  end
153
157
  add_message "io.cucumber.messages.Pickle" do
154
158
  optional :id, :string, 1
155
159
  optional :uri, :string, 2
156
160
  optional :name, :string, 3
157
161
  optional :language, :string, 4
158
- repeated :steps, :message, 5, "io.cucumber.messages.PickleStep"
159
- repeated :tags, :message, 6, "io.cucumber.messages.PickleTag"
162
+ repeated :steps, :message, 5, "io.cucumber.messages.Pickle.PickleStep"
163
+ repeated :tags, :message, 6, "io.cucumber.messages.Pickle.PickleTag"
160
164
  repeated :locations, :message, 7, "io.cucumber.messages.Location"
161
165
  end
162
- add_message "io.cucumber.messages.PickleStep" do
166
+ add_message "io.cucumber.messages.Pickle.PickleTag" do
167
+ optional :location, :message, 1, "io.cucumber.messages.Location"
168
+ optional :name, :string, 2
169
+ end
170
+ add_message "io.cucumber.messages.Pickle.PickleStep" do
163
171
  optional :text, :string, 1
164
172
  repeated :locations, :message, 2, "io.cucumber.messages.Location"
165
- oneof :argument do
166
- optional :doc_string, :message, 3, "io.cucumber.messages.PickleDocString"
167
- optional :data_table, :message, 4, "io.cucumber.messages.PickleTable"
173
+ optional :argument, :message, 5, "io.cucumber.messages.PickleStepArgument"
174
+ end
175
+ add_message "io.cucumber.messages.PickleStepArgument" do
176
+ oneof :message do
177
+ optional :doc_string, :message, 1, "io.cucumber.messages.PickleStepArgument.PickleDocString"
178
+ optional :data_table, :message, 2, "io.cucumber.messages.PickleStepArgument.PickleTable"
168
179
  end
169
180
  end
170
- add_message "io.cucumber.messages.PickleDocString" do
181
+ add_message "io.cucumber.messages.PickleStepArgument.PickleDocString" do
171
182
  optional :location, :message, 1, "io.cucumber.messages.Location"
172
183
  optional :contentType, :string, 2
173
184
  optional :content, :string, 3
174
185
  end
175
- add_message "io.cucumber.messages.PickleTable" do
176
- repeated :rows, :message, 1, "io.cucumber.messages.PickleTableRow"
186
+ add_message "io.cucumber.messages.PickleStepArgument.PickleTable" do
187
+ repeated :rows, :message, 1, "io.cucumber.messages.PickleStepArgument.PickleTable.PickleTableRow"
177
188
  end
178
- add_message "io.cucumber.messages.PickleTableCell" do
179
- optional :location, :message, 1, "io.cucumber.messages.Location"
180
- optional :value, :string, 2
189
+ add_message "io.cucumber.messages.PickleStepArgument.PickleTable.PickleTableRow" do
190
+ repeated :cells, :message, 1, "io.cucumber.messages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell"
181
191
  end
182
- add_message "io.cucumber.messages.PickleTableRow" do
183
- repeated :cells, :message, 1, "io.cucumber.messages.PickleTableCell"
184
- end
185
- add_message "io.cucumber.messages.PickleTag" do
192
+ add_message "io.cucumber.messages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell" do
186
193
  optional :location, :message, 1, "io.cucumber.messages.Location"
187
- optional :name, :string, 2
194
+ optional :value, :string, 2
188
195
  end
189
196
  add_message "io.cucumber.messages.PickleAccepted" do
190
197
  optional :pickleId, :string, 1
@@ -193,6 +200,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
193
200
  optional :pickleId, :string, 2
194
201
  end
195
202
  add_message "io.cucumber.messages.TestRunStarted" do
203
+ optional :timestamp, :message, 1, "google.protobuf.Timestamp"
196
204
  end
197
205
  add_message "io.cucumber.messages.TestCasePreparedStep" do
198
206
  optional :sourceLocation, :message, 1, "io.cucumber.messages.SourceReference"
@@ -205,6 +213,13 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
205
213
  add_message "io.cucumber.messages.TestCaseStarted" do
206
214
  optional :pickleId, :string, 1
207
215
  optional :timestamp, :message, 2, "google.protobuf.Timestamp"
216
+ optional :platform, :message, 3, "io.cucumber.messages.TestCaseStarted.Platform"
217
+ end
218
+ add_message "io.cucumber.messages.TestCaseStarted.Platform" do
219
+ optional :implementation, :string, 1
220
+ optional :version, :string, 2
221
+ optional :os, :string, 3
222
+ optional :cpu, :string, 4
208
223
  end
209
224
  add_message "io.cucumber.messages.TestCaseFinished" do
210
225
  optional :pickleId, :string, 1
@@ -232,10 +247,18 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
232
247
  optional :timestamp, :message, 3, "google.protobuf.Timestamp"
233
248
  end
234
249
  add_message "io.cucumber.messages.TestResult" do
235
- optional :status, :enum, 1, "io.cucumber.messages.Status"
250
+ optional :status, :enum, 1, "io.cucumber.messages.TestResult.Status"
236
251
  optional :message, :string, 2
237
252
  optional :durationNanoseconds, :uint64, 3
238
253
  end
254
+ add_enum "io.cucumber.messages.TestResult.Status" do
255
+ value :AMBIGUOUS, 0
256
+ value :FAILED, 1
257
+ value :PASSED, 2
258
+ value :PENDING, 3
259
+ value :SKIPPED, 4
260
+ value :UNDEFINED, 5
261
+ end
239
262
  add_message "io.cucumber.messages.TestRunFinished" do
240
263
  optional :success, :bool, 1
241
264
  end
@@ -311,53 +334,38 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
311
334
  end
312
335
  add_message "io.cucumber.messages.CommandInitializeTestCase" do
313
336
  optional :actionId, :string, 1
314
- optional :testCaseId, :string, 2
315
337
  optional :pickle, :message, 3, "io.cucumber.messages.Pickle"
316
338
  end
317
339
  add_message "io.cucumber.messages.CommandRunBeforeTestCaseHook" do
318
340
  optional :actionId, :string, 1
319
- optional :testCaseId, :string, 2
320
341
  optional :testCaseHookDefinitionId, :string, 3
342
+ optional :pickleId, :string, 4
321
343
  end
322
344
  add_message "io.cucumber.messages.CommandRunAfterTestCaseHook" do
323
345
  optional :actionId, :string, 1
324
- optional :testCaseId, :string, 2
325
346
  optional :testCaseHookDefinitionId, :string, 3
347
+ optional :pickleId, :string, 4
326
348
  end
327
349
  add_message "io.cucumber.messages.CommandRunTestStep" do
328
350
  optional :actionId, :string, 1
329
- optional :testCaseId, :string, 2
330
351
  optional :stepDefinitionId, :string, 3
331
352
  repeated :patternMatches, :message, 4, "io.cucumber.messages.PatternMatch"
353
+ optional :pickleId, :string, 5
354
+ optional :pickleStepArgument, :message, 6, "io.cucumber.messages.PickleStepArgument"
332
355
  end
333
356
  add_message "io.cucumber.messages.PatternMatch" do
334
357
  repeated :captures, :string, 1
335
358
  optional :parameterTypeName, :string, 2
336
- oneof :pickleArgument do
337
- optional :doc_string, :message, 3, "io.cucumber.messages.PickleDocString"
338
- optional :data_table, :message, 4, "io.cucumber.messages.PickleTable"
339
- end
340
359
  end
341
360
  add_message "io.cucumber.messages.CommandGenerateSnippet" do
342
361
  optional :actionId, :string, 1
343
362
  repeated :generatedExpressions, :message, 2, "io.cucumber.messages.GeneratedExpression"
344
- oneof :pickleArgument do
345
- optional :doc_string, :message, 3, "io.cucumber.messages.PickleDocString"
346
- optional :data_table, :message, 4, "io.cucumber.messages.PickleTable"
347
- end
363
+ optional :pickleStepArgument, :message, 5, "io.cucumber.messages.PickleStepArgument"
348
364
  end
349
365
  add_message "io.cucumber.messages.GeneratedExpression" do
350
366
  optional :text, :string, 1
351
367
  repeated :parameterTypeNames, :string, 2
352
368
  end
353
- add_enum "io.cucumber.messages.Status" do
354
- value :AMBIGUOUS, 0
355
- value :FAILED, 1
356
- value :PASSED, 2
357
- value :PENDING, 3
358
- value :SKIPPED, 4
359
- value :UNDEFINED, 5
360
- end
361
369
  add_enum "io.cucumber.messages.SourcesOrderType" do
362
370
  value :ORDER_OF_DEFINITION, 0
363
371
  value :RANDOM, 1
@@ -370,46 +378,50 @@ end
370
378
 
371
379
  module Cucumber
372
380
  module Messages
373
- Wrapper = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Wrapper").msgclass
374
- SourceReference = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.SourceReference").msgclass
381
+ Envelope = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Envelope").msgclass
375
382
  Location = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Location").msgclass
376
- Attachment = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Attachment").msgclass
383
+ SourceReference = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.SourceReference").msgclass
377
384
  Media = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Media").msgclass
385
+ Media::Encoding = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Media.Encoding").enummodule
378
386
  Source = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Source").msgclass
379
387
  GherkinDocument = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument").msgclass
380
- Feature = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Feature").msgclass
381
- FeatureChild = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.FeatureChild").msgclass
382
- Rule = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Rule").msgclass
383
- RuleChild = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.RuleChild").msgclass
384
- Background = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Background").msgclass
385
- Scenario = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Scenario").msgclass
386
- Comment = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Comment").msgclass
387
- DataTable = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.DataTable").msgclass
388
- DocString = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.DocString").msgclass
389
- Examples = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Examples").msgclass
390
- Step = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Step").msgclass
391
- TableCell = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TableCell").msgclass
392
- TableRow = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TableRow").msgclass
393
- Tag = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Tag").msgclass
388
+ GherkinDocument::Comment = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Comment").msgclass
389
+ GherkinDocument::Feature = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature").msgclass
390
+ GherkinDocument::Feature::Tag = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature.Tag").msgclass
391
+ GherkinDocument::Feature::FeatureChild = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature.FeatureChild").msgclass
392
+ GherkinDocument::Feature::FeatureChild::Rule = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature.FeatureChild.Rule").msgclass
393
+ GherkinDocument::Feature::FeatureChild::RuleChild = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature.FeatureChild.RuleChild").msgclass
394
+ GherkinDocument::Feature::Background = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature.Background").msgclass
395
+ GherkinDocument::Feature::Scenario = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature.Scenario").msgclass
396
+ GherkinDocument::Feature::Scenario::Examples = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature.Scenario.Examples").msgclass
397
+ GherkinDocument::Feature::TableRow = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature.TableRow").msgclass
398
+ GherkinDocument::Feature::TableRow::TableCell = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature.TableRow.TableCell").msgclass
399
+ GherkinDocument::Feature::Step = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature.Step").msgclass
400
+ GherkinDocument::Feature::Step::DataTable = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature.Step.DataTable").msgclass
401
+ GherkinDocument::Feature::Step::DocString = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GherkinDocument.Feature.Step.DocString").msgclass
402
+ Attachment = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Attachment").msgclass
394
403
  Pickle = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Pickle").msgclass
395
- PickleStep = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleStep").msgclass
396
- PickleDocString = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleDocString").msgclass
397
- PickleTable = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleTable").msgclass
398
- PickleTableCell = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleTableCell").msgclass
399
- PickleTableRow = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleTableRow").msgclass
400
- PickleTag = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleTag").msgclass
404
+ Pickle::PickleTag = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Pickle.PickleTag").msgclass
405
+ Pickle::PickleStep = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Pickle.PickleStep").msgclass
406
+ PickleStepArgument = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleStepArgument").msgclass
407
+ PickleStepArgument::PickleDocString = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleStepArgument.PickleDocString").msgclass
408
+ PickleStepArgument::PickleTable = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleStepArgument.PickleTable").msgclass
409
+ PickleStepArgument::PickleTable::PickleTableRow = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleStepArgument.PickleTable.PickleTableRow").msgclass
410
+ PickleStepArgument::PickleTable::PickleTableRow::PickleTableCell = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleStepArgument.PickleTable.PickleTableRow.PickleTableCell").msgclass
401
411
  PickleAccepted = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleAccepted").msgclass
402
412
  PickleRejected = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PickleRejected").msgclass
403
413
  TestRunStarted = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestRunStarted").msgclass
404
414
  TestCasePreparedStep = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestCasePreparedStep").msgclass
405
415
  TestCasePrepared = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestCasePrepared").msgclass
406
416
  TestCaseStarted = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestCaseStarted").msgclass
417
+ TestCaseStarted::Platform = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestCaseStarted.Platform").msgclass
407
418
  TestCaseFinished = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestCaseFinished").msgclass
408
419
  TestStepStarted = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestStepStarted").msgclass
409
420
  TestStepFinished = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestStepFinished").msgclass
410
421
  TestHookStarted = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestHookStarted").msgclass
411
422
  TestHookFinished = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestHookFinished").msgclass
412
423
  TestResult = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestResult").msgclass
424
+ TestResult::Status = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestResult.Status").enummodule
413
425
  TestRunFinished = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.TestRunFinished").msgclass
414
426
  CommandStart = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.CommandStart").msgclass
415
427
  SourcesConfig = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.SourcesConfig").msgclass
@@ -432,7 +444,6 @@ module Cucumber
432
444
  PatternMatch = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.PatternMatch").msgclass
433
445
  CommandGenerateSnippet = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.CommandGenerateSnippet").msgclass
434
446
  GeneratedExpression = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.GeneratedExpression").msgclass
435
- Status = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.Status").enummodule
436
447
  SourcesOrderType = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.SourcesOrderType").enummodule
437
448
  StepDefinitionPatternType = Google::Protobuf::DescriptorPool.generated_pool.lookup("io.cucumber.messages.StepDefinitionPatternType").enummodule
438
449
  end
@@ -0,0 +1,33 @@
1
+ require 'cucumber/messages'
2
+
3
+ module Cucumber
4
+ module Messages
5
+ describe Messages do
6
+
7
+ it "can be serialised over a stream" do
8
+ outgoing_messages = create_outgoing_messages
9
+
10
+ io = StringIO.new
11
+ write_outgoing_messages(outgoing_messages, io)
12
+
13
+ io.rewind
14
+ incoming_messages = ProtobufIoEnumerator.call(io)
15
+
16
+ expect(incoming_messages.to_a).to(eq(outgoing_messages))
17
+ end
18
+
19
+ def create_outgoing_messages
20
+ return [
21
+ Envelope.new(source: Source.new(data: 'Feature: Hello')),
22
+ Envelope.new(attachment: Attachment.new(data: 'some stack trace'))
23
+ ]
24
+ end
25
+
26
+ def write_outgoing_messages(messages, out)
27
+ messages.each do |message|
28
+ message.write_delimited_to(out)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-messages
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aslak Hellesøy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-29 00:00:00.000000000 Z
11
+ date: 2019-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -95,10 +95,13 @@ files:
95
95
  - LICENSE
96
96
  - README.md
97
97
  - lib/cucumber/messages.rb
98
+ - lib/cucumber/messages/protobuf_delimited.rb
99
+ - lib/cucumber/messages/protobuf_io_enumerator.rb
100
+ - lib/cucumber/messages/varint.rb
98
101
  - lib/cucumber/messages_pb.rb
99
102
  - spec/capture_warnings.rb
100
103
  - spec/coverage.rb
101
- - spec/cucumber/messages/messages_spec.rb
104
+ - spec/cucumber/messages/message_serialization_spec.rb
102
105
  homepage: https://github.com/cucumber/cucumber-messages-ruby#readme
103
106
  licenses:
104
107
  - MIT
@@ -124,11 +127,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
127
  - !ruby/object:Gem::Version
125
128
  version: '0'
126
129
  requirements: []
127
- rubygems_version: 3.0.3
130
+ rubyforge_project:
131
+ rubygems_version: 2.7.7
128
132
  signing_key:
129
133
  specification_version: 4
130
- summary: cucumber-messages-2.1.2
134
+ summary: cucumber-messages-3.0.0
131
135
  test_files:
132
- - spec/cucumber/messages/messages_spec.rb
136
+ - spec/cucumber/messages/message_serialization_spec.rb
133
137
  - spec/capture_warnings.rb
134
138
  - spec/coverage.rb
@@ -1,23 +0,0 @@
1
- require 'cucumber/messages_pb'
2
- require 'json'
3
-
4
- module Cucumber
5
- module Messages
6
- describe Messages do
7
- it "builds a pickle doc string" do
8
- location = Location.new(line: 10, column: 20)
9
- pickle_doc_tring = PickleDocString.new(
10
- location: location,
11
- contentType: 'text/plain',
12
- content: 'some\ncontent\n'
13
- )
14
- expect(JSON.parse(PickleDocString.encode_json(pickle_doc_tring)))
15
- .to(eq(
16
- 'location' => { 'line' => 10, 'column' => 20 },
17
- 'contentType' => 'text/plain',
18
- 'content' => 'some\ncontent\n'
19
- ))
20
- end
21
- end
22
- end
23
- end