cucumber-messages 14.0.1 → 16.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/cucumber/messages.rb +1 -9
- data/lib/cucumber/messages/ndjson_to_message_enumerator.rb +2 -2
- data/lib/cucumber/messages/time_conversion.rb +11 -8
- data/spec/cucumber/messages/ndjson_serialization_spec.rb +7 -67
- metadata +3 -30
- data/lib/cucumber/messages.pb.rb +0 -524
- data/lib/cucumber/messages/binary_to_message_enumerator.rb +0 -15
- data/lib/cucumber/messages/protobuf_delimited.rb +0 -21
- data/lib/cucumber/messages/protobuf_ndjson.rb +0 -12
- data/lib/cucumber/messages/varint.rb +0 -37
- data/spec/cucumber/messages/protobuf_serialization_spec.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4622bf55dec7edad8952583388b35281cb02c86874e089b5a2b1725b3453f80e
|
4
|
+
data.tar.gz: d7c120617be9b27ba427cafade373a4cfd21de2889a0fa1b0b6f3a176cbe52ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c3a19e9489140175cc34241a60c8cd25a0894d5bbccf218161570fe1b8f35593f6ae2a43fdafbc2cca090a28416e7e4d1b6ded7038a3b1897ebe2377ecf274b
|
7
|
+
data.tar.gz: e297f0938393dcefdb467eac285a4eda937013136c35d822c7e3d4fb398713e01533fc94251e35f49bc535ee1d83a48532727320f41aaf9074ec67190345b0cd
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
16.0.0
|
data/lib/cucumber/messages.rb
CHANGED
@@ -1,17 +1,9 @@
|
|
1
|
-
require 'cucumber/messages.pb'
|
2
|
-
require 'cucumber/messages/binary_to_message_enumerator'
|
3
1
|
require 'cucumber/messages/ndjson_to_message_enumerator'
|
4
|
-
require 'cucumber/messages/protobuf_delimited'
|
5
|
-
require 'cucumber/messages/protobuf_ndjson'
|
6
2
|
require 'cucumber/messages/time_conversion'
|
7
3
|
require 'cucumber/messages/id_generator'
|
8
4
|
|
9
|
-
Cucumber::Messages::Envelope.include(Cucumber::Messages::WriteNdjson)
|
10
|
-
Cucumber::Messages::Envelope.include(Cucumber::Messages::WriteDelimited)
|
11
|
-
Cucumber::Messages::Envelope.extend(Cucumber::Messages::ParseDelimited)
|
12
|
-
|
13
5
|
module Cucumber
|
14
6
|
module Messages
|
15
7
|
VERSION = File.read(File.expand_path("../../VERSION", __dir__)).strip
|
16
8
|
end
|
17
|
-
end
|
9
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'json'
|
2
2
|
|
3
3
|
module Cucumber
|
4
4
|
module Messages
|
@@ -8,7 +8,7 @@ module Cucumber
|
|
8
8
|
io.each_line do |line|
|
9
9
|
next if line.strip.empty?
|
10
10
|
begin
|
11
|
-
m =
|
11
|
+
m = JSON.parse(line)
|
12
12
|
rescue => e
|
13
13
|
raise "Not JSON: #{line.strip}"
|
14
14
|
end
|
@@ -4,25 +4,28 @@ module Cucumber
|
|
4
4
|
NANOSECONDS_PER_SECOND = 1000000000
|
5
5
|
|
6
6
|
def time_to_timestamp(time)
|
7
|
-
|
8
|
-
seconds
|
9
|
-
nanos
|
10
|
-
|
7
|
+
{
|
8
|
+
'seconds' => time.to_i,
|
9
|
+
'nanos' => time.nsec
|
10
|
+
}
|
11
11
|
end
|
12
12
|
|
13
13
|
def timestamp_to_time(timestamp)
|
14
|
-
Time.at(timestamp
|
14
|
+
Time.at(timestamp['seconds'] + timestamp['nanos'].to_f / NANOSECONDS_PER_SECOND)
|
15
15
|
end
|
16
16
|
|
17
17
|
def seconds_to_duration(seconds_float)
|
18
18
|
seconds, second_modulus = seconds_float.divmod(1)
|
19
19
|
nanos = second_modulus * NANOSECONDS_PER_SECOND
|
20
|
-
|
20
|
+
{
|
21
|
+
'seconds' => seconds,
|
22
|
+
'nanos' => nanos
|
23
|
+
}
|
21
24
|
end
|
22
25
|
|
23
26
|
def duration_to_seconds(duration)
|
24
|
-
seconds_part = duration
|
25
|
-
nanos_part = duration
|
27
|
+
seconds_part = duration['seconds']
|
28
|
+
nanos_part = duration['nanos'].to_f / NANOSECONDS_PER_SECOND
|
26
29
|
seconds_part + nanos_part
|
27
30
|
end
|
28
31
|
end
|
@@ -2,62 +2,11 @@ require 'cucumber/messages'
|
|
2
2
|
|
3
3
|
module Cucumber
|
4
4
|
module Messages
|
5
|
-
describe
|
6
|
-
|
7
|
-
it "json-roundtrips messages" do
|
8
|
-
a1 = Attachment.new(body: 'hello')
|
9
|
-
expect(a1.body).to eq('hello')
|
10
|
-
a2 = Attachment.new(JSON.parse(a1.to_json(proto3: true)))
|
11
|
-
expect(a2).to(eq(a1))
|
12
|
-
end
|
13
|
-
|
14
|
-
it "omits empty string fields in output" do
|
15
|
-
io = StringIO.new
|
16
|
-
message = Envelope.new(source: Source.new(data: ''))
|
17
|
-
message.write_ndjson_to(io)
|
18
|
-
|
19
|
-
io.rewind
|
20
|
-
json = io.read
|
21
|
-
|
22
|
-
expect(json).to eq("{\"source\":{}}\n")
|
23
|
-
end
|
24
|
-
|
25
|
-
it "omits empty number fields in output" do
|
26
|
-
io = StringIO.new
|
27
|
-
message = Envelope.new(
|
28
|
-
test_case_started: TestCaseStarted.new(
|
29
|
-
timestamp: Timestamp.new(
|
30
|
-
seconds: 0
|
31
|
-
)
|
32
|
-
)
|
33
|
-
)
|
34
|
-
message.write_ndjson_to(io)
|
35
|
-
|
36
|
-
io.rewind
|
37
|
-
json = io.read
|
38
|
-
|
39
|
-
expect(json).to eq('{"testCaseStarted":{"timestamp":{}}}' + "\n")
|
40
|
-
end
|
41
|
-
|
42
|
-
it "omits empty repeated fields in output" do
|
43
|
-
io = StringIO.new
|
44
|
-
message = Envelope.new(
|
45
|
-
parameter_type: ParameterType.new(
|
46
|
-
regular_expressions: []
|
47
|
-
)
|
48
|
-
)
|
49
|
-
message.write_ndjson_to(io)
|
50
|
-
|
51
|
-
io.rewind
|
52
|
-
json = io.read
|
53
|
-
|
54
|
-
expect(json).to eq('{"parameterType":{}}' + "\n")
|
55
|
-
end
|
56
|
-
|
5
|
+
describe 'messages' do
|
57
6
|
it "can be serialised over an ndjson stream" do
|
58
7
|
outgoing_messages = [
|
59
|
-
|
60
|
-
|
8
|
+
{'source' => {'data' => 'Feature: Hello'}},
|
9
|
+
{'attachment' => {'binary' => [1,2,3,4].pack('C*')}}
|
61
10
|
]
|
62
11
|
|
63
12
|
io = StringIO.new
|
@@ -71,8 +20,8 @@ module Cucumber
|
|
71
20
|
|
72
21
|
it "ignores empty lines" do
|
73
22
|
outgoing_messages = [
|
74
|
-
|
75
|
-
|
23
|
+
{'source' => {'data' => 'Feature: Hello'}},
|
24
|
+
{'attachment' => {'binary' => [1,2,3,4].pack('C*')}}
|
76
25
|
]
|
77
26
|
|
78
27
|
io = StringIO.new
|
@@ -85,16 +34,6 @@ module Cucumber
|
|
85
34
|
expect(incoming_messages.to_a).to(eq(outgoing_messages))
|
86
35
|
end
|
87
36
|
|
88
|
-
it "ignores missing fields" do
|
89
|
-
io = StringIO.new
|
90
|
-
io.puts('{"unused": 99}')
|
91
|
-
|
92
|
-
io.rewind
|
93
|
-
incoming_messages = NdjsonToMessageEnumerator.new(io)
|
94
|
-
|
95
|
-
expect(incoming_messages.to_a).to(eq([Envelope.new]))
|
96
|
-
end
|
97
|
-
|
98
37
|
it "includes offending line in error message" do
|
99
38
|
io = StringIO.new
|
100
39
|
io.puts('BLA BLA')
|
@@ -107,7 +46,8 @@ module Cucumber
|
|
107
46
|
|
108
47
|
def write_outgoing_messages(messages, out)
|
109
48
|
messages.each do |message|
|
110
|
-
message.
|
49
|
+
out.write(message.to_json)
|
50
|
+
out.write("\n")
|
111
51
|
end
|
112
52
|
end
|
113
53
|
end
|
metadata
CHANGED
@@ -1,35 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-messages
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 16.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: 2021-
|
11
|
+
date: 2021-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: protobuf-cucumber
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '3.10'
|
20
|
-
- - ">="
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: 3.10.8
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '3.10'
|
30
|
-
- - ">="
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 3.10.8
|
33
13
|
- !ruby/object:Gem::Dependency
|
34
14
|
name: rake
|
35
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -79,19 +59,13 @@ files:
|
|
79
59
|
- LICENSE
|
80
60
|
- README.md
|
81
61
|
- VERSION
|
82
|
-
- lib/cucumber/messages.pb.rb
|
83
62
|
- lib/cucumber/messages.rb
|
84
|
-
- lib/cucumber/messages/binary_to_message_enumerator.rb
|
85
63
|
- lib/cucumber/messages/id_generator.rb
|
86
64
|
- lib/cucumber/messages/ndjson_to_message_enumerator.rb
|
87
|
-
- lib/cucumber/messages/protobuf_delimited.rb
|
88
|
-
- lib/cucumber/messages/protobuf_ndjson.rb
|
89
65
|
- lib/cucumber/messages/time_conversion.rb
|
90
|
-
- lib/cucumber/messages/varint.rb
|
91
66
|
- spec/capture_warnings.rb
|
92
67
|
- spec/cucumber/messages/id_generator_spec.rb
|
93
68
|
- spec/cucumber/messages/ndjson_serialization_spec.rb
|
94
|
-
- spec/cucumber/messages/protobuf_serialization_spec.rb
|
95
69
|
- spec/cucumber/messages/time_conversion_spec.rb
|
96
70
|
- spec/cucumber/messages/version_spec.rb
|
97
71
|
homepage: https://github.com/cucumber/messages-ruby#readme
|
@@ -122,11 +96,10 @@ requirements: []
|
|
122
96
|
rubygems_version: 3.1.2
|
123
97
|
signing_key:
|
124
98
|
specification_version: 4
|
125
|
-
summary: cucumber-messages-
|
99
|
+
summary: cucumber-messages-16.0.0
|
126
100
|
test_files:
|
127
101
|
- spec/capture_warnings.rb
|
128
102
|
- spec/cucumber/messages/id_generator_spec.rb
|
129
103
|
- spec/cucumber/messages/ndjson_serialization_spec.rb
|
130
|
-
- spec/cucumber/messages/protobuf_serialization_spec.rb
|
131
104
|
- spec/cucumber/messages/time_conversion_spec.rb
|
132
105
|
- spec/cucumber/messages/version_spec.rb
|
data/lib/cucumber/messages.pb.rb
DELETED
@@ -1,524 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
##
|
4
|
-
# This file is auto-generated. DO NOT EDIT!
|
5
|
-
#
|
6
|
-
require 'protobuf'
|
7
|
-
|
8
|
-
module Cucumber
|
9
|
-
module Messages
|
10
|
-
::Protobuf::Optionable.inject(self) { ::Google::Protobuf::FileOptions }
|
11
|
-
|
12
|
-
##
|
13
|
-
# Message Classes
|
14
|
-
#
|
15
|
-
class Envelope < ::Protobuf::Message; end
|
16
|
-
class Meta < ::Protobuf::Message
|
17
|
-
class Product < ::Protobuf::Message; end
|
18
|
-
class CI < ::Protobuf::Message
|
19
|
-
class Git < ::Protobuf::Message; end
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
|
26
|
-
class Timestamp < ::Protobuf::Message; end
|
27
|
-
class Duration < ::Protobuf::Message; end
|
28
|
-
class Location < ::Protobuf::Message; end
|
29
|
-
class SourceReference < ::Protobuf::Message
|
30
|
-
class JavaMethod < ::Protobuf::Message; end
|
31
|
-
class JavaStackTraceElement < ::Protobuf::Message; end
|
32
|
-
|
33
|
-
end
|
34
|
-
|
35
|
-
class Source < ::Protobuf::Message; end
|
36
|
-
class GherkinDocument < ::Protobuf::Message
|
37
|
-
class Comment < ::Protobuf::Message; end
|
38
|
-
class Feature < ::Protobuf::Message
|
39
|
-
class Tag < ::Protobuf::Message; end
|
40
|
-
class FeatureChild < ::Protobuf::Message
|
41
|
-
class Rule < ::Protobuf::Message; end
|
42
|
-
class RuleChild < ::Protobuf::Message; end
|
43
|
-
|
44
|
-
end
|
45
|
-
|
46
|
-
class Background < ::Protobuf::Message; end
|
47
|
-
class Scenario < ::Protobuf::Message
|
48
|
-
class Examples < ::Protobuf::Message; end
|
49
|
-
|
50
|
-
end
|
51
|
-
|
52
|
-
class TableRow < ::Protobuf::Message
|
53
|
-
class TableCell < ::Protobuf::Message; end
|
54
|
-
|
55
|
-
end
|
56
|
-
|
57
|
-
class Step < ::Protobuf::Message
|
58
|
-
class DataTable < ::Protobuf::Message; end
|
59
|
-
class DocString < ::Protobuf::Message; end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
class Attachment < ::Protobuf::Message
|
70
|
-
class ContentEncoding < ::Protobuf::Enum
|
71
|
-
define :IDENTITY, 0
|
72
|
-
define :BASE64, 1
|
73
|
-
end
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
class Pickle < ::Protobuf::Message
|
78
|
-
class PickleTag < ::Protobuf::Message; end
|
79
|
-
class PickleStep < ::Protobuf::Message; end
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
class PickleStepArgument < ::Protobuf::Message
|
84
|
-
class PickleDocString < ::Protobuf::Message; end
|
85
|
-
class PickleTable < ::Protobuf::Message
|
86
|
-
class PickleTableRow < ::Protobuf::Message
|
87
|
-
class PickleTableCell < ::Protobuf::Message; end
|
88
|
-
|
89
|
-
end
|
90
|
-
|
91
|
-
|
92
|
-
end
|
93
|
-
|
94
|
-
|
95
|
-
end
|
96
|
-
|
97
|
-
class TestCase < ::Protobuf::Message
|
98
|
-
class TestStep < ::Protobuf::Message
|
99
|
-
class StepMatchArgumentsList < ::Protobuf::Message
|
100
|
-
class StepMatchArgument < ::Protobuf::Message
|
101
|
-
class Group < ::Protobuf::Message; end
|
102
|
-
|
103
|
-
end
|
104
|
-
|
105
|
-
|
106
|
-
end
|
107
|
-
|
108
|
-
|
109
|
-
end
|
110
|
-
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
class TestRunStarted < ::Protobuf::Message; end
|
115
|
-
class TestCaseStarted < ::Protobuf::Message; end
|
116
|
-
class TestCaseFinished < ::Protobuf::Message; end
|
117
|
-
class TestStepStarted < ::Protobuf::Message; end
|
118
|
-
class TestStepFinished < ::Protobuf::Message
|
119
|
-
class TestStepResult < ::Protobuf::Message
|
120
|
-
class Status < ::Protobuf::Enum
|
121
|
-
define :UNKNOWN, 0
|
122
|
-
define :PASSED, 1
|
123
|
-
define :SKIPPED, 2
|
124
|
-
define :PENDING, 3
|
125
|
-
define :UNDEFINED, 4
|
126
|
-
define :AMBIGUOUS, 5
|
127
|
-
define :FAILED, 6
|
128
|
-
end
|
129
|
-
|
130
|
-
end
|
131
|
-
|
132
|
-
|
133
|
-
end
|
134
|
-
|
135
|
-
class TestRunFinished < ::Protobuf::Message; end
|
136
|
-
class Hook < ::Protobuf::Message; end
|
137
|
-
class StepDefinition < ::Protobuf::Message
|
138
|
-
class StepDefinitionPattern < ::Protobuf::Message
|
139
|
-
class StepDefinitionPatternType < ::Protobuf::Enum
|
140
|
-
define :CUCUMBER_EXPRESSION, 0
|
141
|
-
define :REGULAR_EXPRESSION, 1
|
142
|
-
end
|
143
|
-
|
144
|
-
end
|
145
|
-
|
146
|
-
|
147
|
-
end
|
148
|
-
|
149
|
-
class ParameterType < ::Protobuf::Message; end
|
150
|
-
class UndefinedParameterType < ::Protobuf::Message; end
|
151
|
-
class ParseError < ::Protobuf::Message; end
|
152
|
-
|
153
|
-
|
154
|
-
##
|
155
|
-
# File Options
|
156
|
-
#
|
157
|
-
set_option :go_package, "messages"
|
158
|
-
|
159
|
-
|
160
|
-
##
|
161
|
-
# Message Fields
|
162
|
-
#
|
163
|
-
class Envelope
|
164
|
-
optional ::Cucumber::Messages::Source, :source, 1
|
165
|
-
optional ::Cucumber::Messages::GherkinDocument, :gherkin_document, 2
|
166
|
-
optional ::Cucumber::Messages::Pickle, :pickle, 3
|
167
|
-
optional ::Cucumber::Messages::StepDefinition, :step_definition, 4
|
168
|
-
optional ::Cucumber::Messages::Hook, :hook, 5
|
169
|
-
optional ::Cucumber::Messages::ParameterType, :parameter_type, 6
|
170
|
-
optional ::Cucumber::Messages::TestCase, :test_case, 7
|
171
|
-
optional ::Cucumber::Messages::UndefinedParameterType, :undefined_parameter_type, 8
|
172
|
-
optional ::Cucumber::Messages::TestRunStarted, :test_run_started, 9
|
173
|
-
optional ::Cucumber::Messages::TestCaseStarted, :test_case_started, 10
|
174
|
-
optional ::Cucumber::Messages::TestStepStarted, :test_step_started, 11
|
175
|
-
optional ::Cucumber::Messages::Attachment, :attachment, 12
|
176
|
-
optional ::Cucumber::Messages::TestStepFinished, :test_step_finished, 13
|
177
|
-
optional ::Cucumber::Messages::TestCaseFinished, :test_case_finished, 14
|
178
|
-
optional ::Cucumber::Messages::TestRunFinished, :test_run_finished, 15
|
179
|
-
optional ::Cucumber::Messages::ParseError, :parse_error, 16
|
180
|
-
optional ::Cucumber::Messages::Meta, :meta, 17
|
181
|
-
end
|
182
|
-
|
183
|
-
class Meta
|
184
|
-
class Product
|
185
|
-
optional :string, :name, 1
|
186
|
-
optional :string, :version, 2
|
187
|
-
end
|
188
|
-
|
189
|
-
class CI
|
190
|
-
class Git
|
191
|
-
optional :string, :remote, 1
|
192
|
-
optional :string, :revision, 2
|
193
|
-
optional :string, :branch, 3
|
194
|
-
optional :string, :tag, 4
|
195
|
-
end
|
196
|
-
|
197
|
-
optional :string, :name, 1
|
198
|
-
optional :string, :url, 2
|
199
|
-
optional ::Cucumber::Messages::Meta::CI::Git, :git, 3
|
200
|
-
end
|
201
|
-
|
202
|
-
optional :string, :protocol_version, 1
|
203
|
-
optional ::Cucumber::Messages::Meta::Product, :implementation, 2
|
204
|
-
optional ::Cucumber::Messages::Meta::Product, :runtime, 3
|
205
|
-
optional ::Cucumber::Messages::Meta::Product, :os, 4
|
206
|
-
optional ::Cucumber::Messages::Meta::Product, :cpu, 5
|
207
|
-
optional ::Cucumber::Messages::Meta::CI, :ci, 6
|
208
|
-
end
|
209
|
-
|
210
|
-
class Timestamp
|
211
|
-
optional :int64, :seconds, 1
|
212
|
-
optional :int32, :nanos, 2
|
213
|
-
end
|
214
|
-
|
215
|
-
class Duration
|
216
|
-
optional :int64, :seconds, 1
|
217
|
-
optional :int32, :nanos, 2
|
218
|
-
end
|
219
|
-
|
220
|
-
class Location
|
221
|
-
optional :uint32, :line, 1
|
222
|
-
optional :uint32, :column, 2
|
223
|
-
end
|
224
|
-
|
225
|
-
class SourceReference
|
226
|
-
class JavaMethod
|
227
|
-
optional :string, :class_name, 1
|
228
|
-
optional :string, :method_name, 2
|
229
|
-
repeated :string, :method_parameter_types, 3
|
230
|
-
end
|
231
|
-
|
232
|
-
class JavaStackTraceElement
|
233
|
-
optional :string, :class_name, 1
|
234
|
-
optional :string, :method_name, 2
|
235
|
-
optional :string, :file_name, 3
|
236
|
-
end
|
237
|
-
|
238
|
-
optional :string, :uri, 1
|
239
|
-
optional ::Cucumber::Messages::SourceReference::JavaMethod, :java_method, 3
|
240
|
-
optional ::Cucumber::Messages::SourceReference::JavaStackTraceElement, :java_stack_trace_element, 4
|
241
|
-
optional ::Cucumber::Messages::Location, :location, 2
|
242
|
-
end
|
243
|
-
|
244
|
-
class Source
|
245
|
-
optional :string, :uri, 1
|
246
|
-
optional :string, :data, 2
|
247
|
-
optional :string, :media_type, 3
|
248
|
-
end
|
249
|
-
|
250
|
-
class GherkinDocument
|
251
|
-
class Comment
|
252
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
253
|
-
optional :string, :text, 2
|
254
|
-
end
|
255
|
-
|
256
|
-
class Feature
|
257
|
-
class Tag
|
258
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
259
|
-
optional :string, :name, 2
|
260
|
-
optional :string, :id, 3
|
261
|
-
end
|
262
|
-
|
263
|
-
class FeatureChild
|
264
|
-
class Rule
|
265
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
266
|
-
optional :string, :keyword, 2
|
267
|
-
optional :string, :name, 3
|
268
|
-
optional :string, :description, 4
|
269
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::FeatureChild::RuleChild, :children, 5
|
270
|
-
optional :string, :id, 6
|
271
|
-
end
|
272
|
-
|
273
|
-
class RuleChild
|
274
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::Background, :background, 1
|
275
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::Scenario, :scenario, 2
|
276
|
-
end
|
277
|
-
|
278
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::FeatureChild::Rule, :rule, 1
|
279
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::Background, :background, 2
|
280
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::Scenario, :scenario, 3
|
281
|
-
end
|
282
|
-
|
283
|
-
class Background
|
284
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
285
|
-
optional :string, :keyword, 2
|
286
|
-
optional :string, :name, 3
|
287
|
-
optional :string, :description, 4
|
288
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Step, :steps, 5
|
289
|
-
optional :string, :id, 6
|
290
|
-
end
|
291
|
-
|
292
|
-
class Scenario
|
293
|
-
class Examples
|
294
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
295
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Tag, :tags, 2
|
296
|
-
optional :string, :keyword, 3
|
297
|
-
optional :string, :name, 4
|
298
|
-
optional :string, :description, 5
|
299
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::TableRow, :table_header, 6
|
300
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::TableRow, :table_body, 7
|
301
|
-
optional :string, :id, 8
|
302
|
-
end
|
303
|
-
|
304
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
305
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Tag, :tags, 2
|
306
|
-
optional :string, :keyword, 3
|
307
|
-
optional :string, :name, 4
|
308
|
-
optional :string, :description, 5
|
309
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Step, :steps, 6
|
310
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Scenario::Examples, :examples, 7
|
311
|
-
optional :string, :id, 8
|
312
|
-
end
|
313
|
-
|
314
|
-
class TableRow
|
315
|
-
class TableCell
|
316
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
317
|
-
optional :string, :value, 2
|
318
|
-
end
|
319
|
-
|
320
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
321
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::TableRow::TableCell, :cells, 2
|
322
|
-
optional :string, :id, 3
|
323
|
-
end
|
324
|
-
|
325
|
-
class Step
|
326
|
-
class DataTable
|
327
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
328
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::TableRow, :rows, 2
|
329
|
-
end
|
330
|
-
|
331
|
-
class DocString
|
332
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
333
|
-
optional :string, :media_type, 2
|
334
|
-
optional :string, :content, 3
|
335
|
-
optional :string, :delimiter, 4
|
336
|
-
end
|
337
|
-
|
338
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
339
|
-
optional :string, :keyword, 2
|
340
|
-
optional :string, :text, 3
|
341
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::Step::DocString, :doc_string, 4
|
342
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::Step::DataTable, :data_table, 5
|
343
|
-
optional :string, :id, 6
|
344
|
-
end
|
345
|
-
|
346
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
347
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Tag, :tags, 2
|
348
|
-
optional :string, :language, 3
|
349
|
-
optional :string, :keyword, 4
|
350
|
-
optional :string, :name, 5
|
351
|
-
optional :string, :description, 6
|
352
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::FeatureChild, :children, 7
|
353
|
-
end
|
354
|
-
|
355
|
-
optional :string, :uri, 1
|
356
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature, :feature, 2
|
357
|
-
repeated ::Cucumber::Messages::GherkinDocument::Comment, :comments, 3
|
358
|
-
end
|
359
|
-
|
360
|
-
class Attachment
|
361
|
-
optional ::Cucumber::Messages::SourceReference, :source, 1
|
362
|
-
optional :string, :test_step_id, 2
|
363
|
-
optional :string, :test_case_started_id, 3
|
364
|
-
optional :string, :body, 4
|
365
|
-
optional :string, :media_type, 5
|
366
|
-
optional ::Cucumber::Messages::Attachment::ContentEncoding, :content_encoding, 6
|
367
|
-
optional :string, :file_name, 7
|
368
|
-
optional :string, :url, 8
|
369
|
-
end
|
370
|
-
|
371
|
-
class Pickle
|
372
|
-
class PickleTag
|
373
|
-
optional :string, :name, 1
|
374
|
-
optional :string, :ast_node_id, 2
|
375
|
-
end
|
376
|
-
|
377
|
-
class PickleStep
|
378
|
-
optional :string, :text, 1
|
379
|
-
optional ::Cucumber::Messages::PickleStepArgument, :argument, 2
|
380
|
-
optional :string, :id, 3
|
381
|
-
repeated :string, :ast_node_ids, 4
|
382
|
-
end
|
383
|
-
|
384
|
-
optional :string, :id, 1
|
385
|
-
optional :string, :uri, 2
|
386
|
-
optional :string, :name, 3
|
387
|
-
optional :string, :language, 4
|
388
|
-
repeated ::Cucumber::Messages::Pickle::PickleStep, :steps, 5
|
389
|
-
repeated ::Cucumber::Messages::Pickle::PickleTag, :tags, 6
|
390
|
-
repeated :string, :ast_node_ids, 7
|
391
|
-
end
|
392
|
-
|
393
|
-
class PickleStepArgument
|
394
|
-
class PickleDocString
|
395
|
-
optional :string, :media_type, 1
|
396
|
-
optional :string, :content, 2
|
397
|
-
end
|
398
|
-
|
399
|
-
class PickleTable
|
400
|
-
class PickleTableRow
|
401
|
-
class PickleTableCell
|
402
|
-
optional :string, :value, 1
|
403
|
-
end
|
404
|
-
|
405
|
-
repeated ::Cucumber::Messages::PickleStepArgument::PickleTable::PickleTableRow::PickleTableCell, :cells, 1
|
406
|
-
end
|
407
|
-
|
408
|
-
repeated ::Cucumber::Messages::PickleStepArgument::PickleTable::PickleTableRow, :rows, 1
|
409
|
-
end
|
410
|
-
|
411
|
-
optional ::Cucumber::Messages::PickleStepArgument::PickleDocString, :doc_string, 1
|
412
|
-
optional ::Cucumber::Messages::PickleStepArgument::PickleTable, :data_table, 2
|
413
|
-
end
|
414
|
-
|
415
|
-
class TestCase
|
416
|
-
class TestStep
|
417
|
-
class StepMatchArgumentsList
|
418
|
-
class StepMatchArgument
|
419
|
-
class Group
|
420
|
-
optional :uint32, :start, 1
|
421
|
-
optional :string, :value, 2
|
422
|
-
repeated ::Cucumber::Messages::TestCase::TestStep::StepMatchArgumentsList::StepMatchArgument::Group, :children, 3
|
423
|
-
end
|
424
|
-
|
425
|
-
optional :string, :parameter_type_name, 1
|
426
|
-
optional ::Cucumber::Messages::TestCase::TestStep::StepMatchArgumentsList::StepMatchArgument::Group, :group, 2
|
427
|
-
end
|
428
|
-
|
429
|
-
repeated ::Cucumber::Messages::TestCase::TestStep::StepMatchArgumentsList::StepMatchArgument, :step_match_arguments, 1
|
430
|
-
end
|
431
|
-
|
432
|
-
optional :string, :id, 1
|
433
|
-
optional :string, :pickle_step_id, 2
|
434
|
-
repeated :string, :step_definition_ids, 3
|
435
|
-
repeated ::Cucumber::Messages::TestCase::TestStep::StepMatchArgumentsList, :step_match_arguments_lists, 4
|
436
|
-
optional :string, :hook_id, 5
|
437
|
-
end
|
438
|
-
|
439
|
-
optional :string, :id, 1
|
440
|
-
optional :string, :pickle_id, 2
|
441
|
-
repeated ::Cucumber::Messages::TestCase::TestStep, :test_steps, 3
|
442
|
-
end
|
443
|
-
|
444
|
-
class TestRunStarted
|
445
|
-
optional ::Cucumber::Messages::Timestamp, :timestamp, 1
|
446
|
-
end
|
447
|
-
|
448
|
-
class TestCaseStarted
|
449
|
-
optional ::Cucumber::Messages::Timestamp, :timestamp, 1
|
450
|
-
optional :uint32, :attempt, 3
|
451
|
-
optional :string, :test_case_id, 4
|
452
|
-
optional :string, :id, 5
|
453
|
-
end
|
454
|
-
|
455
|
-
class TestCaseFinished
|
456
|
-
optional ::Cucumber::Messages::Timestamp, :timestamp, 1
|
457
|
-
optional :string, :test_case_started_id, 3
|
458
|
-
end
|
459
|
-
|
460
|
-
class TestStepStarted
|
461
|
-
optional ::Cucumber::Messages::Timestamp, :timestamp, 1
|
462
|
-
optional :string, :test_step_id, 2
|
463
|
-
optional :string, :test_case_started_id, 3
|
464
|
-
end
|
465
|
-
|
466
|
-
class TestStepFinished
|
467
|
-
class TestStepResult
|
468
|
-
optional ::Cucumber::Messages::TestStepFinished::TestStepResult::Status, :status, 1
|
469
|
-
optional :string, :message, 2
|
470
|
-
optional ::Cucumber::Messages::Duration, :duration, 3
|
471
|
-
optional :bool, :will_be_retried, 4
|
472
|
-
end
|
473
|
-
|
474
|
-
optional ::Cucumber::Messages::TestStepFinished::TestStepResult, :test_step_result, 1
|
475
|
-
optional ::Cucumber::Messages::Timestamp, :timestamp, 2
|
476
|
-
optional :string, :test_step_id, 3
|
477
|
-
optional :string, :test_case_started_id, 4
|
478
|
-
end
|
479
|
-
|
480
|
-
class TestRunFinished
|
481
|
-
optional :bool, :success, 1
|
482
|
-
optional ::Cucumber::Messages::Timestamp, :timestamp, 2
|
483
|
-
optional :string, :message, 3
|
484
|
-
end
|
485
|
-
|
486
|
-
class Hook
|
487
|
-
optional :string, :id, 1
|
488
|
-
optional :string, :tag_expression, 2
|
489
|
-
optional ::Cucumber::Messages::SourceReference, :source_reference, 3
|
490
|
-
end
|
491
|
-
|
492
|
-
class StepDefinition
|
493
|
-
class StepDefinitionPattern
|
494
|
-
optional :string, :source, 1
|
495
|
-
optional ::Cucumber::Messages::StepDefinition::StepDefinitionPattern::StepDefinitionPatternType, :type, 2
|
496
|
-
end
|
497
|
-
|
498
|
-
optional :string, :id, 1
|
499
|
-
optional ::Cucumber::Messages::StepDefinition::StepDefinitionPattern, :pattern, 2
|
500
|
-
optional ::Cucumber::Messages::SourceReference, :source_reference, 3
|
501
|
-
end
|
502
|
-
|
503
|
-
class ParameterType
|
504
|
-
optional :string, :name, 1
|
505
|
-
repeated :string, :regular_expressions, 2
|
506
|
-
optional :bool, :prefer_for_regular_expression_match, 3
|
507
|
-
optional :bool, :use_for_snippets, 4
|
508
|
-
optional :string, :id, 5
|
509
|
-
end
|
510
|
-
|
511
|
-
class UndefinedParameterType
|
512
|
-
optional :string, :name, 1
|
513
|
-
optional :string, :expression, 2
|
514
|
-
end
|
515
|
-
|
516
|
-
class ParseError
|
517
|
-
optional ::Cucumber::Messages::SourceReference, :source, 1
|
518
|
-
optional :string, :message, 2
|
519
|
-
end
|
520
|
-
|
521
|
-
end
|
522
|
-
|
523
|
-
end
|
524
|
-
|
@@ -1,15 +0,0 @@
|
|
1
|
-
require 'cucumber/messages/varint'
|
2
|
-
|
3
|
-
module Cucumber
|
4
|
-
module Messages
|
5
|
-
class BinaryToMessageEnumerator < Enumerator
|
6
|
-
def initialize(io)
|
7
|
-
super() 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
|
@@ -1,21 +0,0 @@
|
|
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
|
@@ -1,37 +0,0 @@
|
|
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
|
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'cucumber/messages'
|
2
|
-
|
3
|
-
module Cucumber
|
4
|
-
module Messages
|
5
|
-
describe Messages do
|
6
|
-
|
7
|
-
it "can be serialised over a binary stream" do
|
8
|
-
outgoing_messages = [
|
9
|
-
Envelope.new(source: Source.new(data: 'Feature: Hello')),
|
10
|
-
Envelope.new(attachment: Attachment.new(body: "JALLA"))
|
11
|
-
]
|
12
|
-
|
13
|
-
io = StringIO.new
|
14
|
-
write_outgoing_messages(outgoing_messages, io)
|
15
|
-
|
16
|
-
io.rewind
|
17
|
-
incoming_messages = BinaryToMessageEnumerator.new(io)
|
18
|
-
|
19
|
-
expect(incoming_messages.to_a).to(eq(outgoing_messages))
|
20
|
-
end
|
21
|
-
|
22
|
-
def write_outgoing_messages(messages, out)
|
23
|
-
messages.each do |message|
|
24
|
-
message.write_delimited_to(out)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|