cucumber-messages 14.1.0 → 16.0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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 +5 -32
- data/lib/cucumber/messages.pb.rb +0 -525
- 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: 5dc7353136f14ca646f8548de717c06e42a44fe7fed631fbfc56be51b5c82b7f
|
4
|
+
data.tar.gz: c654cce5e60eb55e7099af06d20ef3dae13f041fba5168f31a2cd53e437b42cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9319a4c524c81b9ae89d5d0972015bb44b38039d54f4b7bc6a2387a90c2db6c200c8ff02e15a048d88ee117569c004992ff784ad2379241b22b4cde05d3f3c12
|
7
|
+
data.tar.gz: 3109430754f68352da28323be284797bd9f7a5e131cec07e0e0034f2cf1fd00c23cf1dbe8d93ee07024eafeace3dc3ff0553a7f6cce951749d94d35152e6f26a
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
16.0.1
|
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.1
|
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-24 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
|
@@ -99,10 +73,10 @@ licenses:
|
|
99
73
|
- MIT
|
100
74
|
metadata:
|
101
75
|
bug_tracker_uri: https://github.com/cucumber/cucumber/issues
|
102
|
-
changelog_uri: https://github.com/cucumber/
|
76
|
+
changelog_uri: https://github.com/cucumber/common/blob/main/messages/CHANGELOG.md
|
103
77
|
documentation_uri: https://www.rubydoc.info/github/cucumber/messages-ruby
|
104
78
|
mailing_list_uri: https://groups.google.com/forum/#!forum/cukes
|
105
|
-
source_code_uri: https://github.com/cucumber/
|
79
|
+
source_code_uri: https://github.com/cucumber/common/blob/main/messages/ruby
|
106
80
|
post_install_message:
|
107
81
|
rdoc_options:
|
108
82
|
- "--charset=UTF-8"
|
@@ -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.1
|
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,525 +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
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Tag, :tags, 7
|
272
|
-
end
|
273
|
-
|
274
|
-
class RuleChild
|
275
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::Background, :background, 1
|
276
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::Scenario, :scenario, 2
|
277
|
-
end
|
278
|
-
|
279
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::FeatureChild::Rule, :rule, 1
|
280
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::Background, :background, 2
|
281
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::Scenario, :scenario, 3
|
282
|
-
end
|
283
|
-
|
284
|
-
class Background
|
285
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
286
|
-
optional :string, :keyword, 2
|
287
|
-
optional :string, :name, 3
|
288
|
-
optional :string, :description, 4
|
289
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Step, :steps, 5
|
290
|
-
optional :string, :id, 6
|
291
|
-
end
|
292
|
-
|
293
|
-
class Scenario
|
294
|
-
class Examples
|
295
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
296
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Tag, :tags, 2
|
297
|
-
optional :string, :keyword, 3
|
298
|
-
optional :string, :name, 4
|
299
|
-
optional :string, :description, 5
|
300
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::TableRow, :table_header, 6
|
301
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::TableRow, :table_body, 7
|
302
|
-
optional :string, :id, 8
|
303
|
-
end
|
304
|
-
|
305
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
306
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Tag, :tags, 2
|
307
|
-
optional :string, :keyword, 3
|
308
|
-
optional :string, :name, 4
|
309
|
-
optional :string, :description, 5
|
310
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Step, :steps, 6
|
311
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Scenario::Examples, :examples, 7
|
312
|
-
optional :string, :id, 8
|
313
|
-
end
|
314
|
-
|
315
|
-
class TableRow
|
316
|
-
class TableCell
|
317
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
318
|
-
optional :string, :value, 2
|
319
|
-
end
|
320
|
-
|
321
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
322
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::TableRow::TableCell, :cells, 2
|
323
|
-
optional :string, :id, 3
|
324
|
-
end
|
325
|
-
|
326
|
-
class Step
|
327
|
-
class DataTable
|
328
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
329
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::TableRow, :rows, 2
|
330
|
-
end
|
331
|
-
|
332
|
-
class DocString
|
333
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
334
|
-
optional :string, :media_type, 2
|
335
|
-
optional :string, :content, 3
|
336
|
-
optional :string, :delimiter, 4
|
337
|
-
end
|
338
|
-
|
339
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
340
|
-
optional :string, :keyword, 2
|
341
|
-
optional :string, :text, 3
|
342
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::Step::DocString, :doc_string, 4
|
343
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature::Step::DataTable, :data_table, 5
|
344
|
-
optional :string, :id, 6
|
345
|
-
end
|
346
|
-
|
347
|
-
optional ::Cucumber::Messages::Location, :location, 1
|
348
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::Tag, :tags, 2
|
349
|
-
optional :string, :language, 3
|
350
|
-
optional :string, :keyword, 4
|
351
|
-
optional :string, :name, 5
|
352
|
-
optional :string, :description, 6
|
353
|
-
repeated ::Cucumber::Messages::GherkinDocument::Feature::FeatureChild, :children, 7
|
354
|
-
end
|
355
|
-
|
356
|
-
optional :string, :uri, 1
|
357
|
-
optional ::Cucumber::Messages::GherkinDocument::Feature, :feature, 2
|
358
|
-
repeated ::Cucumber::Messages::GherkinDocument::Comment, :comments, 3
|
359
|
-
end
|
360
|
-
|
361
|
-
class Attachment
|
362
|
-
optional ::Cucumber::Messages::SourceReference, :source, 1
|
363
|
-
optional :string, :test_step_id, 2
|
364
|
-
optional :string, :test_case_started_id, 3
|
365
|
-
optional :string, :body, 4
|
366
|
-
optional :string, :media_type, 5
|
367
|
-
optional ::Cucumber::Messages::Attachment::ContentEncoding, :content_encoding, 6
|
368
|
-
optional :string, :file_name, 7
|
369
|
-
optional :string, :url, 8
|
370
|
-
end
|
371
|
-
|
372
|
-
class Pickle
|
373
|
-
class PickleTag
|
374
|
-
optional :string, :name, 1
|
375
|
-
optional :string, :ast_node_id, 2
|
376
|
-
end
|
377
|
-
|
378
|
-
class PickleStep
|
379
|
-
optional :string, :text, 1
|
380
|
-
optional ::Cucumber::Messages::PickleStepArgument, :argument, 2
|
381
|
-
optional :string, :id, 3
|
382
|
-
repeated :string, :ast_node_ids, 4
|
383
|
-
end
|
384
|
-
|
385
|
-
optional :string, :id, 1
|
386
|
-
optional :string, :uri, 2
|
387
|
-
optional :string, :name, 3
|
388
|
-
optional :string, :language, 4
|
389
|
-
repeated ::Cucumber::Messages::Pickle::PickleStep, :steps, 5
|
390
|
-
repeated ::Cucumber::Messages::Pickle::PickleTag, :tags, 6
|
391
|
-
repeated :string, :ast_node_ids, 7
|
392
|
-
end
|
393
|
-
|
394
|
-
class PickleStepArgument
|
395
|
-
class PickleDocString
|
396
|
-
optional :string, :media_type, 1
|
397
|
-
optional :string, :content, 2
|
398
|
-
end
|
399
|
-
|
400
|
-
class PickleTable
|
401
|
-
class PickleTableRow
|
402
|
-
class PickleTableCell
|
403
|
-
optional :string, :value, 1
|
404
|
-
end
|
405
|
-
|
406
|
-
repeated ::Cucumber::Messages::PickleStepArgument::PickleTable::PickleTableRow::PickleTableCell, :cells, 1
|
407
|
-
end
|
408
|
-
|
409
|
-
repeated ::Cucumber::Messages::PickleStepArgument::PickleTable::PickleTableRow, :rows, 1
|
410
|
-
end
|
411
|
-
|
412
|
-
optional ::Cucumber::Messages::PickleStepArgument::PickleDocString, :doc_string, 1
|
413
|
-
optional ::Cucumber::Messages::PickleStepArgument::PickleTable, :data_table, 2
|
414
|
-
end
|
415
|
-
|
416
|
-
class TestCase
|
417
|
-
class TestStep
|
418
|
-
class StepMatchArgumentsList
|
419
|
-
class StepMatchArgument
|
420
|
-
class Group
|
421
|
-
optional :uint32, :start, 1
|
422
|
-
optional :string, :value, 2
|
423
|
-
repeated ::Cucumber::Messages::TestCase::TestStep::StepMatchArgumentsList::StepMatchArgument::Group, :children, 3
|
424
|
-
end
|
425
|
-
|
426
|
-
optional :string, :parameter_type_name, 1
|
427
|
-
optional ::Cucumber::Messages::TestCase::TestStep::StepMatchArgumentsList::StepMatchArgument::Group, :group, 2
|
428
|
-
end
|
429
|
-
|
430
|
-
repeated ::Cucumber::Messages::TestCase::TestStep::StepMatchArgumentsList::StepMatchArgument, :step_match_arguments, 1
|
431
|
-
end
|
432
|
-
|
433
|
-
optional :string, :id, 1
|
434
|
-
optional :string, :pickle_step_id, 2
|
435
|
-
repeated :string, :step_definition_ids, 3
|
436
|
-
repeated ::Cucumber::Messages::TestCase::TestStep::StepMatchArgumentsList, :step_match_arguments_lists, 4
|
437
|
-
optional :string, :hook_id, 5
|
438
|
-
end
|
439
|
-
|
440
|
-
optional :string, :id, 1
|
441
|
-
optional :string, :pickle_id, 2
|
442
|
-
repeated ::Cucumber::Messages::TestCase::TestStep, :test_steps, 3
|
443
|
-
end
|
444
|
-
|
445
|
-
class TestRunStarted
|
446
|
-
optional ::Cucumber::Messages::Timestamp, :timestamp, 1
|
447
|
-
end
|
448
|
-
|
449
|
-
class TestCaseStarted
|
450
|
-
optional ::Cucumber::Messages::Timestamp, :timestamp, 1
|
451
|
-
optional :uint32, :attempt, 3
|
452
|
-
optional :string, :test_case_id, 4
|
453
|
-
optional :string, :id, 5
|
454
|
-
end
|
455
|
-
|
456
|
-
class TestCaseFinished
|
457
|
-
optional ::Cucumber::Messages::Timestamp, :timestamp, 1
|
458
|
-
optional :string, :test_case_started_id, 3
|
459
|
-
end
|
460
|
-
|
461
|
-
class TestStepStarted
|
462
|
-
optional ::Cucumber::Messages::Timestamp, :timestamp, 1
|
463
|
-
optional :string, :test_step_id, 2
|
464
|
-
optional :string, :test_case_started_id, 3
|
465
|
-
end
|
466
|
-
|
467
|
-
class TestStepFinished
|
468
|
-
class TestStepResult
|
469
|
-
optional ::Cucumber::Messages::TestStepFinished::TestStepResult::Status, :status, 1
|
470
|
-
optional :string, :message, 2
|
471
|
-
optional ::Cucumber::Messages::Duration, :duration, 3
|
472
|
-
optional :bool, :will_be_retried, 4
|
473
|
-
end
|
474
|
-
|
475
|
-
optional ::Cucumber::Messages::TestStepFinished::TestStepResult, :test_step_result, 1
|
476
|
-
optional ::Cucumber::Messages::Timestamp, :timestamp, 2
|
477
|
-
optional :string, :test_step_id, 3
|
478
|
-
optional :string, :test_case_started_id, 4
|
479
|
-
end
|
480
|
-
|
481
|
-
class TestRunFinished
|
482
|
-
optional :bool, :success, 1
|
483
|
-
optional ::Cucumber::Messages::Timestamp, :timestamp, 2
|
484
|
-
optional :string, :message, 3
|
485
|
-
end
|
486
|
-
|
487
|
-
class Hook
|
488
|
-
optional :string, :id, 1
|
489
|
-
optional :string, :tag_expression, 2
|
490
|
-
optional ::Cucumber::Messages::SourceReference, :source_reference, 3
|
491
|
-
end
|
492
|
-
|
493
|
-
class StepDefinition
|
494
|
-
class StepDefinitionPattern
|
495
|
-
optional :string, :source, 1
|
496
|
-
optional ::Cucumber::Messages::StepDefinition::StepDefinitionPattern::StepDefinitionPatternType, :type, 2
|
497
|
-
end
|
498
|
-
|
499
|
-
optional :string, :id, 1
|
500
|
-
optional ::Cucumber::Messages::StepDefinition::StepDefinitionPattern, :pattern, 2
|
501
|
-
optional ::Cucumber::Messages::SourceReference, :source_reference, 3
|
502
|
-
end
|
503
|
-
|
504
|
-
class ParameterType
|
505
|
-
optional :string, :name, 1
|
506
|
-
repeated :string, :regular_expressions, 2
|
507
|
-
optional :bool, :prefer_for_regular_expression_match, 3
|
508
|
-
optional :bool, :use_for_snippets, 4
|
509
|
-
optional :string, :id, 5
|
510
|
-
end
|
511
|
-
|
512
|
-
class UndefinedParameterType
|
513
|
-
optional :string, :name, 1
|
514
|
-
optional :string, :expression, 2
|
515
|
-
end
|
516
|
-
|
517
|
-
class ParseError
|
518
|
-
optional ::Cucumber::Messages::SourceReference, :source, 1
|
519
|
-
optional :string, :message, 2
|
520
|
-
end
|
521
|
-
|
522
|
-
end
|
523
|
-
|
524
|
-
end
|
525
|
-
|
@@ -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
|