cucumber 0.1.12 → 0.1.13
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.
- data/History.txt +38 -3
- data/Manifest.txt +17 -1
- data/README.txt +2 -39
- data/bin/cucumber +1 -1
- data/examples/calculator_ruby_features/features/addition.rb +16 -0
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -0
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +1 -0
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +1 -0
- data/examples/i18n/fr/features/addition.feature +13 -11
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +6 -2
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -0
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +2 -0
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +1 -0
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -0
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -0
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +1 -0
- data/examples/selenium/features/search.feature +1 -1
- data/examples/selenium/features/step_definitons/stories_steps.rb +2 -3
- data/examples/tickets/features/lib/eatting_machine.rb +18 -0
- data/examples/tickets/features/lib/pantry.rb +20 -0
- data/examples/tickets/features/scenario_outline.feature +64 -0
- data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +34 -0
- data/examples/tickets/features/step_definitons/tickets_steps.rb +4 -0
- data/gem_tasks/fix_cr_lf.rake +1 -1
- data/gem_tasks/yard.rake +8 -0
- data/lib/autotest/cucumber_mixin.rb +3 -3
- data/lib/cucumber.rb +2 -0
- data/lib/cucumber/broadcaster.rb +1 -1
- data/lib/cucumber/cli.rb +87 -42
- data/lib/cucumber/core_ext/exception.rb +20 -0
- data/lib/cucumber/core_ext/string.rb +1 -1
- data/lib/cucumber/executor.rb +35 -18
- data/lib/cucumber/formatters/ansicolor.rb +65 -74
- data/lib/cucumber/formatters/html_formatter.rb +33 -10
- data/lib/cucumber/formatters/pretty_formatter.rb +58 -16
- data/lib/cucumber/formatters/progress_formatter.rb +3 -0
- data/lib/cucumber/formatters/unicode.rb +27 -0
- data/lib/cucumber/languages.yml +6 -4
- data/lib/cucumber/platform.rb +1 -0
- data/lib/cucumber/rails/world.rb +6 -6
- data/lib/cucumber/step_mother.rb +3 -0
- data/lib/cucumber/tree/feature.rb +28 -2
- data/lib/cucumber/tree/scenario.rb +62 -1
- data/lib/cucumber/tree/step.rb +32 -1
- data/lib/cucumber/treetop_parser/feature.treetop.erb +54 -7
- data/lib/cucumber/treetop_parser/feature_ar.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_cy.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_da.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_de.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_en-lol.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_en-tx.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_en.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_es.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_et.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_fr.rb +389 -30
- data/lib/cucumber/treetop_parser/feature_id.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_it.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_ja.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_lt.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_nl.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_no.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_pl.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_pt.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_ro.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_ro2.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_ru.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_se.rb +377 -18
- data/lib/cucumber/treetop_parser/feature_zh-CN.rb +377 -18
- data/lib/cucumber/version.rb +1 -1
- data/lib/cucumber/world.rb +1 -0
- data/lib/cucumber/world/pending.rb +22 -0
- data/rails_generators/cucumber/templates/env.rb +1 -0
- data/rails_generators/feature/feature_generator.rb +22 -2
- data/rails_generators/feature/templates/feature.erb +15 -12
- data/rails_generators/feature/templates/steps.erb +16 -14
- data/spec/cucumber/cli_spec.rb +87 -6
- data/spec/cucumber/executor_spec.rb +102 -30
- data/spec/cucumber/formatters/ansicolor_spec.rb +10 -10
- data/spec/cucumber/formatters/html_formatter_spec.rb +30 -0
- data/spec/cucumber/formatters/pretty_formatter_spec.rb +139 -4
- data/spec/cucumber/formatters/progress_formatter_spec.rb +16 -0
- data/spec/cucumber/tree/feature_spec.rb +84 -5
- data/spec/cucumber/tree/row_scenario_outline_spec.rb +73 -0
- data/spec/cucumber/tree/row_step_outline_spec.rb +38 -0
- data/spec/cucumber/tree/scenario_outline_spec.rb +50 -0
- data/spec/cucumber/tree/step_outline_spec.rb +17 -0
- data/spec/cucumber/tree/step_spec.rb +9 -0
- data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +3 -0
- data/spec/cucumber/treetop_parser/feature_parser_spec.rb +22 -0
- data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +7 -0
- data/spec/cucumber/treetop_parser/scenario_outline.feature +16 -0
- data/spec/cucumber/world/pending_spec.rb +46 -0
- data/spec/spec_helper.rb +2 -1
- metadata +19 -4
- data/TODO.txt +0 -26
@@ -9,7 +9,9 @@ module Cucumber
|
|
9
9
|
|
10
10
|
def accept(visitor)
|
11
11
|
steps.each do |step|
|
12
|
-
if step.row?
|
12
|
+
if step.outline? && !step.row?
|
13
|
+
visitor.visit_step_outline(step)
|
14
|
+
elsif step.row?
|
13
15
|
visitor.visit_row_step(step)
|
14
16
|
else
|
15
17
|
visitor.visit_regular_step(step)
|
@@ -31,6 +33,10 @@ module Cucumber
|
|
31
33
|
steps.empty?
|
32
34
|
end
|
33
35
|
|
36
|
+
def outline?
|
37
|
+
false
|
38
|
+
end
|
39
|
+
|
34
40
|
end
|
35
41
|
|
36
42
|
class Scenario < BaseScenario
|
@@ -129,6 +135,22 @@ module Cucumber
|
|
129
135
|
|
130
136
|
end
|
131
137
|
|
138
|
+
class ScenarioOutline < Scenario
|
139
|
+
def outline?
|
140
|
+
true
|
141
|
+
end
|
142
|
+
|
143
|
+
def length
|
144
|
+
@length ||= Cucumber.language['scenario_outline'].jlength + 2 + (@name.nil? ? 0 : @name.jlength)
|
145
|
+
end
|
146
|
+
|
147
|
+
def create_step(keyword, name, line)
|
148
|
+
step = StepOutline.new(self, keyword, name, line)
|
149
|
+
@steps_and_given_scenarios << step
|
150
|
+
step
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
132
154
|
class RowScenario < BaseScenario
|
133
155
|
attr_reader :line
|
134
156
|
|
@@ -171,5 +193,44 @@ module Cucumber
|
|
171
193
|
end
|
172
194
|
|
173
195
|
end
|
196
|
+
|
197
|
+
class RowScenarioOutline < RowScenario
|
198
|
+
def outline?
|
199
|
+
true
|
200
|
+
end
|
201
|
+
|
202
|
+
def steps
|
203
|
+
@processed_placeholders = []
|
204
|
+
@steps ||= @template_scenario.steps.map do |template_step|
|
205
|
+
build_row_step_outline(template_step)
|
206
|
+
end
|
207
|
+
end
|
208
|
+
|
209
|
+
private
|
210
|
+
|
211
|
+
def build_row_step_outline(template_step)
|
212
|
+
step_name = template_step.name
|
213
|
+
placeholder_values = []
|
214
|
+
|
215
|
+
@template_scenario.table_header.each_with_index do |column_name, column_number|
|
216
|
+
|
217
|
+
if step_name =~ placeholder_regexp(column_name)
|
218
|
+
step_name = step_name.gsub(placeholder_regexp(column_name), @values[column_number])
|
219
|
+
|
220
|
+
unless @processed_placeholders.include?(column_name)
|
221
|
+
placeholder_values << @values[column_number]
|
222
|
+
@processed_placeholders << column_name
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|
227
|
+
RowStepOutline.new(self, template_step, step_name, placeholder_values, @line)
|
228
|
+
end
|
229
|
+
|
230
|
+
def placeholder_regexp(string)
|
231
|
+
/#{Regexp.escape("<#{string}>")}/
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
174
235
|
end
|
175
236
|
end
|
data/lib/cucumber/tree/step.rb
CHANGED
@@ -90,6 +90,14 @@ module Cucumber
|
|
90
90
|
def padding_length
|
91
91
|
@scenario.step_padding_length(self)
|
92
92
|
end
|
93
|
+
|
94
|
+
def forced_to_pending?
|
95
|
+
@error.kind_of?(ForcedPending)
|
96
|
+
end
|
97
|
+
|
98
|
+
def outline?
|
99
|
+
false
|
100
|
+
end
|
93
101
|
end
|
94
102
|
|
95
103
|
class Step < BaseStep
|
@@ -102,7 +110,7 @@ module Cucumber
|
|
102
110
|
|
103
111
|
def initialize(scenario, keyword, name, line)
|
104
112
|
@scenario, @keyword, @name, @line = scenario, keyword, name, line
|
105
|
-
@extra_args
|
113
|
+
@extra_args ||= []
|
106
114
|
@arity = 0
|
107
115
|
end
|
108
116
|
|
@@ -117,6 +125,12 @@ module Cucumber
|
|
117
125
|
end
|
118
126
|
end
|
119
127
|
|
128
|
+
class StepOutline < Step
|
129
|
+
def outline?
|
130
|
+
true
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
120
134
|
class RowStep < BaseStep
|
121
135
|
attr_reader :keyword
|
122
136
|
|
@@ -138,5 +152,22 @@ module Cucumber
|
|
138
152
|
end
|
139
153
|
end
|
140
154
|
|
155
|
+
class RowStepOutline < Step
|
156
|
+
attr_reader :visible_args
|
157
|
+
|
158
|
+
def initialize(scenario, step, name, visible_args, line)
|
159
|
+
@visible_args = visible_args
|
160
|
+
@extra_args = step.extra_args
|
161
|
+
super(scenario, keyword, name, line)
|
162
|
+
end
|
163
|
+
|
164
|
+
def row?
|
165
|
+
true
|
166
|
+
end
|
167
|
+
|
168
|
+
def outline?
|
169
|
+
true
|
170
|
+
end
|
171
|
+
end
|
141
172
|
end
|
142
173
|
end
|
@@ -13,23 +13,27 @@ grammar Feature
|
|
13
13
|
end
|
14
14
|
|
15
15
|
rule header
|
16
|
-
(!(scenario_keyword / comment_to_eol) .)+
|
16
|
+
(!(scenario_keyword / scenario_outline_keyword / comment_to_eol) .)+
|
17
17
|
end
|
18
18
|
|
19
19
|
rule scenario_sequence
|
20
|
-
head:
|
20
|
+
head:scenario_outline_or_scenario? tail:(space scenario_or_scenario_outline_or_table)* {
|
21
21
|
def compile(feature)
|
22
|
-
([head] + tail).each do |
|
23
|
-
|
22
|
+
([head] + tail).each do |scenario_or_scenario_outline_or_table|
|
23
|
+
scenario_or_scenario_outline_or_table.compile(feature) if scenario_or_scenario_outline_or_table.respond_to?(:compile)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
def tail
|
28
|
-
super.elements.map { |elt| elt.
|
28
|
+
super.elements.map { |elt| elt.scenario_or_scenario_outline_or_table }
|
29
29
|
end
|
30
30
|
}
|
31
31
|
end
|
32
32
|
|
33
|
+
rule scenario_outline_or_scenario
|
34
|
+
scenario_outline / scenario
|
35
|
+
end
|
36
|
+
|
33
37
|
rule scenario
|
34
38
|
scenario_keyword space? name:line_to_eol steps:(space step_sequence)? {
|
35
39
|
def compile(feature)
|
@@ -42,9 +46,29 @@ grammar Feature
|
|
42
46
|
end
|
43
47
|
}
|
44
48
|
end
|
49
|
+
|
50
|
+
rule scenario_outline
|
51
|
+
scenario_outline_keyword space? name:line_to_eol outline_body:(steps_and_optional_examples)? {
|
52
|
+
def compile(feature)
|
53
|
+
line = input.line_of(interval.first)
|
54
|
+
scenario = feature.add_scenario_outline(name.text_value.strip, line)
|
55
|
+
Feature.last_scenario = scenario
|
56
|
+
outline_body.compile(feature, scenario) if outline_body.respond_to?(:compile)
|
57
|
+
end
|
58
|
+
}
|
59
|
+
end
|
45
60
|
|
46
|
-
rule
|
47
|
-
scenario / more_examples
|
61
|
+
rule scenario_or_scenario_outline_or_table
|
62
|
+
scenario_outline / (scenario / more_examples)
|
63
|
+
end
|
64
|
+
|
65
|
+
rule steps_and_optional_examples
|
66
|
+
steps:(space step_sequence) table:(space examples)? {
|
67
|
+
def compile(feature, scenario)
|
68
|
+
steps.step_sequence.compile(scenario) if steps.respond_to?(:step_sequence)
|
69
|
+
table.examples.compile(feature, scenario) if table.respond_to?(:examples) && table.examples.respond_to?(:compile)
|
70
|
+
end
|
71
|
+
}
|
48
72
|
end
|
49
73
|
|
50
74
|
rule more_examples
|
@@ -55,6 +79,14 @@ grammar Feature
|
|
55
79
|
}
|
56
80
|
end
|
57
81
|
|
82
|
+
rule examples
|
83
|
+
examples_keyword table {
|
84
|
+
def compile(feature, scenario)
|
85
|
+
table.compile_examples(feature, scenario)
|
86
|
+
end
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
58
90
|
rule table
|
59
91
|
space head:table_line body:(blank* eol space? table_line)* {
|
60
92
|
def compile(feature)
|
@@ -64,6 +96,13 @@ grammar Feature
|
|
64
96
|
end
|
65
97
|
end
|
66
98
|
|
99
|
+
def compile_examples(feature, scenario)
|
100
|
+
scenario.table_header = head.cell_values
|
101
|
+
body.each do |table_line|
|
102
|
+
feature.add_row_scenario_outline(scenario, table_line.cell_values, table_line.line)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
67
106
|
def matrix
|
68
107
|
([head] + body).map do |table_line|
|
69
108
|
table_line.cell_values # We're losing the line - we'll get it back when we make our own class
|
@@ -192,10 +231,18 @@ grammar Feature
|
|
192
231
|
"<%= words['scenario'] %>" ":"?
|
193
232
|
end
|
194
233
|
|
234
|
+
rule scenario_outline_keyword
|
235
|
+
"<%= words['scenario_outline'] %>" ":"?
|
236
|
+
end
|
237
|
+
|
195
238
|
rule more_examples_keyword
|
196
239
|
"<%= words['more_examples'] %>" ":"?
|
197
240
|
end
|
198
241
|
|
242
|
+
rule examples_keyword
|
243
|
+
"<%= words['examples'] %>" ":"?
|
244
|
+
end
|
245
|
+
|
199
246
|
rule given_scenario_keyword
|
200
247
|
"<%= words['given_scenario'] %>" ":"?
|
201
248
|
end
|
@@ -94,12 +94,17 @@ module Feature
|
|
94
94
|
if r4
|
95
95
|
r3 = r4
|
96
96
|
else
|
97
|
-
r5 =
|
97
|
+
r5 = _nt_scenario_outline_keyword
|
98
98
|
if r5
|
99
99
|
r3 = r5
|
100
100
|
else
|
101
|
-
|
102
|
-
|
101
|
+
r6 = _nt_comment_to_eol
|
102
|
+
if r6
|
103
|
+
r3 = r6
|
104
|
+
else
|
105
|
+
self.index = i3
|
106
|
+
r3 = nil
|
107
|
+
end
|
103
108
|
end
|
104
109
|
end
|
105
110
|
if r3
|
@@ -111,13 +116,13 @@ module Feature
|
|
111
116
|
s1 << r2
|
112
117
|
if r2
|
113
118
|
if index < input_length
|
114
|
-
|
119
|
+
r7 = (SyntaxNode).new(input, index...(index + 1))
|
115
120
|
@index += 1
|
116
121
|
else
|
117
122
|
terminal_parse_failure("any character")
|
118
|
-
|
123
|
+
r7 = nil
|
119
124
|
end
|
120
|
-
s1 <<
|
125
|
+
s1 << r7
|
121
126
|
end
|
122
127
|
if s1.last
|
123
128
|
r1 = (SyntaxNode).new(input, i1...index, s1)
|
@@ -149,7 +154,7 @@ module Feature
|
|
149
154
|
elements[0]
|
150
155
|
end
|
151
156
|
|
152
|
-
def
|
157
|
+
def scenario_or_scenario_outline_or_table
|
153
158
|
elements[1]
|
154
159
|
end
|
155
160
|
end
|
@@ -166,13 +171,13 @@ module Feature
|
|
166
171
|
|
167
172
|
module ScenarioSequence2
|
168
173
|
def compile(feature)
|
169
|
-
([head] + tail).each do |
|
170
|
-
|
174
|
+
([head] + tail).each do |scenario_or_scenario_outline_or_table|
|
175
|
+
scenario_or_scenario_outline_or_table.compile(feature) if scenario_or_scenario_outline_or_table.respond_to?(:compile)
|
171
176
|
end
|
172
177
|
end
|
173
178
|
|
174
179
|
def tail
|
175
|
-
super.elements.map { |elt| elt.
|
180
|
+
super.elements.map { |elt| elt.scenario_or_scenario_outline_or_table }
|
176
181
|
end
|
177
182
|
end
|
178
183
|
|
@@ -185,7 +190,7 @@ module Feature
|
|
185
190
|
end
|
186
191
|
|
187
192
|
i0, s0 = index, []
|
188
|
-
r2 =
|
193
|
+
r2 = _nt_scenario_outline_or_scenario
|
189
194
|
if r2
|
190
195
|
r1 = r2
|
191
196
|
else
|
@@ -199,7 +204,7 @@ module Feature
|
|
199
204
|
r5 = _nt_space
|
200
205
|
s4 << r5
|
201
206
|
if r5
|
202
|
-
r6 =
|
207
|
+
r6 = _nt_scenario_or_scenario_outline_or_table
|
203
208
|
s4 << r6
|
204
209
|
end
|
205
210
|
if s4.last
|
@@ -232,6 +237,33 @@ module Feature
|
|
232
237
|
return r0
|
233
238
|
end
|
234
239
|
|
240
|
+
def _nt_scenario_outline_or_scenario
|
241
|
+
start_index = index
|
242
|
+
if node_cache[:scenario_outline_or_scenario].has_key?(index)
|
243
|
+
cached = node_cache[:scenario_outline_or_scenario][index]
|
244
|
+
@index = cached.interval.end if cached
|
245
|
+
return cached
|
246
|
+
end
|
247
|
+
|
248
|
+
i0 = index
|
249
|
+
r1 = _nt_scenario_outline
|
250
|
+
if r1
|
251
|
+
r0 = r1
|
252
|
+
else
|
253
|
+
r2 = _nt_scenario
|
254
|
+
if r2
|
255
|
+
r0 = r2
|
256
|
+
else
|
257
|
+
self.index = i0
|
258
|
+
r0 = nil
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
node_cache[:scenario_outline_or_scenario][start_index] = r0
|
263
|
+
|
264
|
+
return r0
|
265
|
+
end
|
266
|
+
|
235
267
|
module Scenario0
|
236
268
|
def space
|
237
269
|
elements[0]
|
@@ -327,20 +359,102 @@ module Feature
|
|
327
359
|
return r0
|
328
360
|
end
|
329
361
|
|
330
|
-
|
362
|
+
module ScenarioOutline0
|
363
|
+
def scenario_outline_keyword
|
364
|
+
elements[0]
|
365
|
+
end
|
366
|
+
|
367
|
+
def name
|
368
|
+
elements[2]
|
369
|
+
end
|
370
|
+
|
371
|
+
def outline_body
|
372
|
+
elements[3]
|
373
|
+
end
|
374
|
+
end
|
375
|
+
|
376
|
+
module ScenarioOutline1
|
377
|
+
def compile(feature)
|
378
|
+
line = input.line_of(interval.first)
|
379
|
+
scenario = feature.add_scenario_outline(name.text_value.strip, line)
|
380
|
+
Feature.last_scenario = scenario
|
381
|
+
outline_body.compile(feature, scenario) if outline_body.respond_to?(:compile)
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
def _nt_scenario_outline
|
331
386
|
start_index = index
|
332
|
-
if node_cache[:
|
333
|
-
cached = node_cache[:
|
387
|
+
if node_cache[:scenario_outline].has_key?(index)
|
388
|
+
cached = node_cache[:scenario_outline][index]
|
389
|
+
@index = cached.interval.end if cached
|
390
|
+
return cached
|
391
|
+
end
|
392
|
+
|
393
|
+
i0, s0 = index, []
|
394
|
+
r1 = _nt_scenario_outline_keyword
|
395
|
+
s0 << r1
|
396
|
+
if r1
|
397
|
+
r3 = _nt_space
|
398
|
+
if r3
|
399
|
+
r2 = r3
|
400
|
+
else
|
401
|
+
r2 = SyntaxNode.new(input, index...index)
|
402
|
+
end
|
403
|
+
s0 << r2
|
404
|
+
if r2
|
405
|
+
r4 = _nt_line_to_eol
|
406
|
+
s0 << r4
|
407
|
+
if r4
|
408
|
+
r6 = _nt_steps_and_optional_examples
|
409
|
+
if r6
|
410
|
+
r5 = r6
|
411
|
+
else
|
412
|
+
r5 = SyntaxNode.new(input, index...index)
|
413
|
+
end
|
414
|
+
s0 << r5
|
415
|
+
end
|
416
|
+
end
|
417
|
+
end
|
418
|
+
if s0.last
|
419
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
420
|
+
r0.extend(ScenarioOutline0)
|
421
|
+
r0.extend(ScenarioOutline1)
|
422
|
+
else
|
423
|
+
self.index = i0
|
424
|
+
r0 = nil
|
425
|
+
end
|
426
|
+
|
427
|
+
node_cache[:scenario_outline][start_index] = r0
|
428
|
+
|
429
|
+
return r0
|
430
|
+
end
|
431
|
+
|
432
|
+
def _nt_scenario_or_scenario_outline_or_table
|
433
|
+
start_index = index
|
434
|
+
if node_cache[:scenario_or_scenario_outline_or_table].has_key?(index)
|
435
|
+
cached = node_cache[:scenario_or_scenario_outline_or_table][index]
|
334
436
|
@index = cached.interval.end if cached
|
335
437
|
return cached
|
336
438
|
end
|
337
439
|
|
338
440
|
i0 = index
|
339
|
-
r1 =
|
441
|
+
r1 = _nt_scenario_outline
|
340
442
|
if r1
|
341
443
|
r0 = r1
|
342
444
|
else
|
343
|
-
|
445
|
+
i2 = index
|
446
|
+
r3 = _nt_scenario
|
447
|
+
if r3
|
448
|
+
r2 = r3
|
449
|
+
else
|
450
|
+
r4 = _nt_more_examples
|
451
|
+
if r4
|
452
|
+
r2 = r4
|
453
|
+
else
|
454
|
+
self.index = i2
|
455
|
+
r2 = nil
|
456
|
+
end
|
457
|
+
end
|
344
458
|
if r2
|
345
459
|
r0 = r2
|
346
460
|
else
|
@@ -349,7 +463,104 @@ module Feature
|
|
349
463
|
end
|
350
464
|
end
|
351
465
|
|
352
|
-
node_cache[:
|
466
|
+
node_cache[:scenario_or_scenario_outline_or_table][start_index] = r0
|
467
|
+
|
468
|
+
return r0
|
469
|
+
end
|
470
|
+
|
471
|
+
module StepsAndOptionalExamples0
|
472
|
+
def space
|
473
|
+
elements[0]
|
474
|
+
end
|
475
|
+
|
476
|
+
def step_sequence
|
477
|
+
elements[1]
|
478
|
+
end
|
479
|
+
end
|
480
|
+
|
481
|
+
module StepsAndOptionalExamples1
|
482
|
+
def space
|
483
|
+
elements[0]
|
484
|
+
end
|
485
|
+
|
486
|
+
def examples
|
487
|
+
elements[1]
|
488
|
+
end
|
489
|
+
end
|
490
|
+
|
491
|
+
module StepsAndOptionalExamples2
|
492
|
+
def steps
|
493
|
+
elements[0]
|
494
|
+
end
|
495
|
+
|
496
|
+
def table
|
497
|
+
elements[1]
|
498
|
+
end
|
499
|
+
end
|
500
|
+
|
501
|
+
module StepsAndOptionalExamples3
|
502
|
+
def compile(feature, scenario)
|
503
|
+
steps.step_sequence.compile(scenario) if steps.respond_to?(:step_sequence)
|
504
|
+
table.examples.compile(feature, scenario) if table.respond_to?(:examples) && table.examples.respond_to?(:compile)
|
505
|
+
end
|
506
|
+
end
|
507
|
+
|
508
|
+
def _nt_steps_and_optional_examples
|
509
|
+
start_index = index
|
510
|
+
if node_cache[:steps_and_optional_examples].has_key?(index)
|
511
|
+
cached = node_cache[:steps_and_optional_examples][index]
|
512
|
+
@index = cached.interval.end if cached
|
513
|
+
return cached
|
514
|
+
end
|
515
|
+
|
516
|
+
i0, s0 = index, []
|
517
|
+
i1, s1 = index, []
|
518
|
+
r2 = _nt_space
|
519
|
+
s1 << r2
|
520
|
+
if r2
|
521
|
+
r3 = _nt_step_sequence
|
522
|
+
s1 << r3
|
523
|
+
end
|
524
|
+
if s1.last
|
525
|
+
r1 = (SyntaxNode).new(input, i1...index, s1)
|
526
|
+
r1.extend(StepsAndOptionalExamples0)
|
527
|
+
else
|
528
|
+
self.index = i1
|
529
|
+
r1 = nil
|
530
|
+
end
|
531
|
+
s0 << r1
|
532
|
+
if r1
|
533
|
+
i5, s5 = index, []
|
534
|
+
r6 = _nt_space
|
535
|
+
s5 << r6
|
536
|
+
if r6
|
537
|
+
r7 = _nt_examples
|
538
|
+
s5 << r7
|
539
|
+
end
|
540
|
+
if s5.last
|
541
|
+
r5 = (SyntaxNode).new(input, i5...index, s5)
|
542
|
+
r5.extend(StepsAndOptionalExamples1)
|
543
|
+
else
|
544
|
+
self.index = i5
|
545
|
+
r5 = nil
|
546
|
+
end
|
547
|
+
if r5
|
548
|
+
r4 = r5
|
549
|
+
else
|
550
|
+
r4 = SyntaxNode.new(input, index...index)
|
551
|
+
end
|
552
|
+
s0 << r4
|
553
|
+
end
|
554
|
+
if s0.last
|
555
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
556
|
+
r0.extend(StepsAndOptionalExamples2)
|
557
|
+
r0.extend(StepsAndOptionalExamples3)
|
558
|
+
else
|
559
|
+
self.index = i0
|
560
|
+
r0 = nil
|
561
|
+
end
|
562
|
+
|
563
|
+
node_cache[:steps_and_optional_examples][start_index] = r0
|
353
564
|
|
354
565
|
return r0
|
355
566
|
end
|
@@ -399,6 +610,51 @@ module Feature
|
|
399
610
|
return r0
|
400
611
|
end
|
401
612
|
|
613
|
+
module Examples0
|
614
|
+
def examples_keyword
|
615
|
+
elements[0]
|
616
|
+
end
|
617
|
+
|
618
|
+
def table
|
619
|
+
elements[1]
|
620
|
+
end
|
621
|
+
end
|
622
|
+
|
623
|
+
module Examples1
|
624
|
+
def compile(feature, scenario)
|
625
|
+
table.compile_examples(feature, scenario)
|
626
|
+
end
|
627
|
+
end
|
628
|
+
|
629
|
+
def _nt_examples
|
630
|
+
start_index = index
|
631
|
+
if node_cache[:examples].has_key?(index)
|
632
|
+
cached = node_cache[:examples][index]
|
633
|
+
@index = cached.interval.end if cached
|
634
|
+
return cached
|
635
|
+
end
|
636
|
+
|
637
|
+
i0, s0 = index, []
|
638
|
+
r1 = _nt_examples_keyword
|
639
|
+
s0 << r1
|
640
|
+
if r1
|
641
|
+
r2 = _nt_table
|
642
|
+
s0 << r2
|
643
|
+
end
|
644
|
+
if s0.last
|
645
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
646
|
+
r0.extend(Examples0)
|
647
|
+
r0.extend(Examples1)
|
648
|
+
else
|
649
|
+
self.index = i0
|
650
|
+
r0 = nil
|
651
|
+
end
|
652
|
+
|
653
|
+
node_cache[:examples][start_index] = r0
|
654
|
+
|
655
|
+
return r0
|
656
|
+
end
|
657
|
+
|
402
658
|
module Table0
|
403
659
|
def eol
|
404
660
|
elements[1]
|
@@ -431,6 +687,13 @@ module Feature
|
|
431
687
|
end
|
432
688
|
end
|
433
689
|
|
690
|
+
def compile_examples(feature, scenario)
|
691
|
+
scenario.table_header = head.cell_values
|
692
|
+
body.each do |table_line|
|
693
|
+
feature.add_row_scenario_outline(scenario, table_line.cell_values, table_line.line)
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
434
697
|
def matrix
|
435
698
|
([head] + body).map do |table_line|
|
436
699
|
table_line.cell_values # We're losing the line - we'll get it back when we make our own class
|
@@ -1484,6 +1747,54 @@ module Feature
|
|
1484
1747
|
return r0
|
1485
1748
|
end
|
1486
1749
|
|
1750
|
+
module ScenarioOutlineKeyword0
|
1751
|
+
end
|
1752
|
+
|
1753
|
+
def _nt_scenario_outline_keyword
|
1754
|
+
start_index = index
|
1755
|
+
if node_cache[:scenario_outline_keyword].has_key?(index)
|
1756
|
+
cached = node_cache[:scenario_outline_keyword][index]
|
1757
|
+
@index = cached.interval.end if cached
|
1758
|
+
return cached
|
1759
|
+
end
|
1760
|
+
|
1761
|
+
i0, s0 = index, []
|
1762
|
+
if input.index("Scenario Outline", index) == index
|
1763
|
+
r1 = (SyntaxNode).new(input, index...(index + 16))
|
1764
|
+
@index += 16
|
1765
|
+
else
|
1766
|
+
terminal_parse_failure("Scenario Outline")
|
1767
|
+
r1 = nil
|
1768
|
+
end
|
1769
|
+
s0 << r1
|
1770
|
+
if r1
|
1771
|
+
if input.index(":", index) == index
|
1772
|
+
r3 = (SyntaxNode).new(input, index...(index + 1))
|
1773
|
+
@index += 1
|
1774
|
+
else
|
1775
|
+
terminal_parse_failure(":")
|
1776
|
+
r3 = nil
|
1777
|
+
end
|
1778
|
+
if r3
|
1779
|
+
r2 = r3
|
1780
|
+
else
|
1781
|
+
r2 = SyntaxNode.new(input, index...index)
|
1782
|
+
end
|
1783
|
+
s0 << r2
|
1784
|
+
end
|
1785
|
+
if s0.last
|
1786
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
1787
|
+
r0.extend(ScenarioOutlineKeyword0)
|
1788
|
+
else
|
1789
|
+
self.index = i0
|
1790
|
+
r0 = nil
|
1791
|
+
end
|
1792
|
+
|
1793
|
+
node_cache[:scenario_outline_keyword][start_index] = r0
|
1794
|
+
|
1795
|
+
return r0
|
1796
|
+
end
|
1797
|
+
|
1487
1798
|
module MoreExamplesKeyword0
|
1488
1799
|
end
|
1489
1800
|
|
@@ -1532,6 +1843,54 @@ module Feature
|
|
1532
1843
|
return r0
|
1533
1844
|
end
|
1534
1845
|
|
1846
|
+
module ExamplesKeyword0
|
1847
|
+
end
|
1848
|
+
|
1849
|
+
def _nt_examples_keyword
|
1850
|
+
start_index = index
|
1851
|
+
if node_cache[:examples_keyword].has_key?(index)
|
1852
|
+
cached = node_cache[:examples_keyword][index]
|
1853
|
+
@index = cached.interval.end if cached
|
1854
|
+
return cached
|
1855
|
+
end
|
1856
|
+
|
1857
|
+
i0, s0 = index, []
|
1858
|
+
if input.index("Examples", index) == index
|
1859
|
+
r1 = (SyntaxNode).new(input, index...(index + 8))
|
1860
|
+
@index += 8
|
1861
|
+
else
|
1862
|
+
terminal_parse_failure("Examples")
|
1863
|
+
r1 = nil
|
1864
|
+
end
|
1865
|
+
s0 << r1
|
1866
|
+
if r1
|
1867
|
+
if input.index(":", index) == index
|
1868
|
+
r3 = (SyntaxNode).new(input, index...(index + 1))
|
1869
|
+
@index += 1
|
1870
|
+
else
|
1871
|
+
terminal_parse_failure(":")
|
1872
|
+
r3 = nil
|
1873
|
+
end
|
1874
|
+
if r3
|
1875
|
+
r2 = r3
|
1876
|
+
else
|
1877
|
+
r2 = SyntaxNode.new(input, index...index)
|
1878
|
+
end
|
1879
|
+
s0 << r2
|
1880
|
+
end
|
1881
|
+
if s0.last
|
1882
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
1883
|
+
r0.extend(ExamplesKeyword0)
|
1884
|
+
else
|
1885
|
+
self.index = i0
|
1886
|
+
r0 = nil
|
1887
|
+
end
|
1888
|
+
|
1889
|
+
node_cache[:examples_keyword][start_index] = r0
|
1890
|
+
|
1891
|
+
return r0
|
1892
|
+
end
|
1893
|
+
|
1535
1894
|
module GivenScenarioKeyword0
|
1536
1895
|
end
|
1537
1896
|
|