cucumber 0.1.8 → 0.1.9
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 +86 -3
- data/Manifest.txt +93 -44
- data/Rakefile +5 -1
- data/bin/cucumber +1 -0
- data/cucumber.yml +1 -1
- data/examples/calculator_ruby_features/features/{steps → step_definitons}/calculator_steps.rb +0 -0
- data/examples/cs/features/{steps → step_definitons}/hello_steps.rb +0 -0
- data/examples/cs/features/{steps → step_definitons}/tree_steps.rb +0 -0
- data/examples/i18n/README.textile +18 -0
- data/examples/i18n/Rakefile +16 -0
- data/examples/i18n/ar/Rakefile +6 -0
- data/examples/i18n/ar/features/addition.feature +17 -0
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +31 -0
- data/examples/i18n/ar/lib/calculator.rb +10 -0
- data/examples/i18n/da/Rakefile +6 -0
- data/examples/{danish_calculator/features/steps → i18n/da/features/step_definitons}/kalkulator_steps.rb +0 -0
- data/examples/{danish_calculator → i18n/da}/features/summering.feature +1 -1
- data/examples/{danish_calculator → i18n/da}/lib/kalkulator.rb +0 -0
- data/examples/{swedish_calculator → i18n/en}/Rakefile +1 -1
- data/examples/{calculator → i18n/en}/features/addition.feature +0 -0
- data/examples/{calculator → i18n/en}/features/division.feature +0 -0
- data/examples/{calculator/features/steps → i18n/en/features/step_definitons}/calculator_steps.rb +0 -0
- data/examples/{calculator → i18n/en}/lib/calculator.rb +0 -2
- data/examples/i18n/es/Rakefile +6 -0
- data/examples/{spanish_calculator → i18n/es}/features/adicion.feature +1 -1
- data/examples/{spanish_calculator/features/steps → i18n/es/features/step_definitons}/calculador_steps.rb +0 -0
- data/examples/{spanish_calculator/lib/Calculador.rb → i18n/es/lib/calculador.rb} +0 -0
- data/examples/i18n/et/Rakefile +6 -0
- data/examples/i18n/et/features/liitmine.feature +17 -0
- data/examples/{estonian_calculator/features → i18n/et/features/step_definitions}/kalkulaator_steps.rb +2 -11
- data/examples/i18n/et/lib/kalkulaator.rb +10 -0
- data/examples/i18n/fr/Rakefile +6 -0
- data/examples/{calculatrice_francaise_avec_soit_scenario → i18n/fr}/features/addition.feature +0 -0
- data/examples/{calculatrice_francaise_avec_soit_scenario/features → i18n/fr/features/step_definitions}/calculatrice_steps.rb +2 -11
- data/examples/i18n/fr/lib/calculatrice.rb +10 -0
- data/examples/i18n/id/Rakefile +6 -0
- data/examples/i18n/id/features/addition.feature +17 -0
- data/examples/i18n/id/features/division.feature +10 -0
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +31 -0
- data/examples/i18n/id/lib/calculator.rb +14 -0
- data/examples/i18n/it/Rakefile +6 -0
- data/examples/i18n/it/features/somma.feature +10 -0
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +22 -0
- data/examples/i18n/it/lib/calcolatrice.rb +11 -0
- data/examples/{calculator → i18n/ja}/README.txt +0 -0
- data/examples/i18n/ja/Rakefile +6 -0
- data/examples/i18n/ja/features/addition.feature +17 -0
- data/examples/i18n/ja/features/division.feature +10 -0
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +30 -0
- data/examples/i18n/ja/lib/calculator.rb +14 -0
- data/examples/i18n/no/Rakefile +6 -0
- data/examples/{norwegian_calculator/features/steps → i18n/no/features/step_definitons}/kalkulator_steps.rb +0 -0
- data/examples/{norwegian_calculator → i18n/no}/features/summering.feature +0 -0
- data/examples/{norwegian_calculator → i18n/no}/lib/kalkulator.rb +0 -0
- data/examples/i18n/pt/Rakefile +6 -0
- data/examples/{portuguese_calculator → i18n/pt}/features/adicao.feature +0 -0
- data/examples/{portuguese_calculator/features → i18n/pt/features/step_definitions}/calculadora_steps.rb +2 -11
- data/examples/i18n/pt/lib/calculadora.rb +10 -0
- data/examples/i18n/ro/Rakefile +6 -0
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +22 -0
- data/examples/i18n/ro/features/suma.feature +10 -0
- data/examples/i18n/ro/lib/calculator.rb +11 -0
- data/examples/i18n/se/Rakefile +6 -0
- data/examples/{swedish_calculator/features/steps → i18n/se/features/step_definitons}/kalkulator_steps.rb +0 -0
- data/examples/{swedish_calculator → i18n/se}/features/summering.feature +0 -0
- data/examples/{swedish_calculator → i18n/se}/lib/kalkulator.rb +0 -0
- data/examples/i18n/zh-CN/Rakefile +6 -0
- data/examples/{chinese_simplified_calculator → i18n/zh-CN}/features/addition.feature +0 -0
- data/examples/{chinese_simplified_calculator/features/steps → i18n/zh-CN/features/step_definitons}/calculator_steps.rb +0 -0
- data/examples/{chinese_simplified_calculator → i18n/zh-CN}/lib/calculator.rb +0 -0
- data/examples/java/features/{steps → step_definitons}/hello_steps.rb +0 -0
- data/examples/java/features/{steps → step_definitons}/tree_steps.rb +0 -0
- data/examples/selenium/features/{steps → step_definitons}/stories_steps.rb +0 -0
- data/examples/tickets/features/{steps → step_definitons}/tickets_steps.rb +0 -0
- data/examples/watir/features/search.feature +2 -2
- data/examples/watir/features/{steps → step_definitons}/stories_steps.rb +0 -0
- data/gem_tasks/treetop.rake +1 -9
- data/lib/autotest/cucumber.rb +6 -0
- data/lib/autotest/cucumber_mixin.rb +109 -0
- data/lib/autotest/cucumber_rails.rb +6 -0
- data/lib/autotest/cucumber_rails_rspec.rb +6 -0
- data/lib/autotest/cucumber_rspec.rb +6 -0
- data/lib/autotest/discover.rb +9 -0
- data/lib/cucumber.rb +4 -0
- data/lib/cucumber/broadcaster.rb +20 -0
- data/lib/cucumber/cli.rb +139 -48
- data/lib/cucumber/core_ext/proc.rb +2 -3
- data/lib/cucumber/executor.rb +59 -32
- data/lib/cucumber/formatters.rb +1 -1
- data/lib/cucumber/formatters/ansicolor.rb +3 -4
- data/lib/cucumber/formatters/autotest_formatter.rb +23 -0
- data/lib/cucumber/formatters/pretty_formatter.rb +99 -42
- data/lib/cucumber/formatters/progress_formatter.rb +21 -5
- data/lib/cucumber/languages.yml +125 -10
- data/lib/cucumber/rails/world.rb +1 -1
- data/lib/cucumber/rake/task.rb +52 -26
- data/lib/cucumber/step_mother.rb +7 -1
- data/lib/cucumber/tree/feature.rb +8 -6
- data/lib/cucumber/tree/scenario.rb +34 -15
- data/lib/cucumber/tree/step.rb +3 -1
- data/lib/cucumber/treetop_parser/feature.treetop.erb +15 -10
- data/lib/cucumber/treetop_parser/feature_ar.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_cy.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_da.rb +238 -240
- data/lib/cucumber/treetop_parser/feature_de.rb +238 -240
- data/lib/cucumber/treetop_parser/feature_en-tx.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_en.rb +238 -240
- data/lib/cucumber/treetop_parser/feature_es.rb +238 -240
- data/lib/cucumber/treetop_parser/feature_et.rb +238 -240
- data/lib/cucumber/treetop_parser/feature_fr.rb +238 -240
- data/lib/cucumber/treetop_parser/feature_id.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_it.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_ja.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_nl.rb +238 -240
- data/lib/cucumber/treetop_parser/feature_no.rb +238 -240
- data/lib/cucumber/treetop_parser/feature_pl.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_pt.rb +238 -240
- data/lib/cucumber/treetop_parser/feature_ro.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_ro2.rb +1591 -0
- data/lib/cucumber/treetop_parser/feature_ru.rb +238 -240
- data/lib/cucumber/treetop_parser/feature_se.rb +238 -240
- data/lib/cucumber/treetop_parser/feature_zh-CN.rb +238 -240
- data/lib/cucumber/version.rb +1 -1
- data/rails_generators/cucumber/USAGE +11 -0
- data/rails_generators/cucumber/cucumber_generator.rb +9 -6
- data/rails_generators/cucumber/templates/cucumber +6 -1
- data/rails_generators/cucumber/templates/{common_webrat.rb → webrat_steps.rb} +4 -0
- data/rails_generators/feature/USAGE +12 -0
- data/rails_generators/feature/feature_generator.rb +3 -4
- data/spec/cucumber/broadcaster_spec.rb +27 -0
- data/spec/cucumber/cli_spec.rb +211 -23
- data/spec/cucumber/executor_spec.rb +104 -14
- data/spec/cucumber/formatters/ansicolor_spec.rb +9 -1
- data/spec/cucumber/formatters/autotest_formatter_spec.rb +26 -0
- data/spec/cucumber/formatters/pretty_formatter_spec.rb +119 -26
- data/spec/cucumber/formatters/profile_formatter_spec.rb +1 -2
- data/spec/cucumber/formatters/progress_formatter_spec.rb +22 -1
- data/spec/cucumber/sell_cucumbers.feature +10 -0
- data/spec/cucumber/step_mother_spec.rb +21 -0
- data/spec/cucumber/tree/row_scenario_spec.rb +25 -0
- data/spec/cucumber/tree/scenario_spec.rb +47 -8
- data/spec/cucumber/tree/step_spec.rb +19 -0
- data/spec/cucumber/treetop_parser/feature_parser_spec.rb +2 -0
- data/spec/cucumber/treetop_parser/multiline_steps.feature +7 -3
- data/spec/spec_helper.rb +2 -0
- metadata +97 -48
- data/examples/calculator/Rakefile +0 -5
- data/examples/calculatrice_francaise_avec_soit_scenario/Rakefile +0 -6
- data/examples/chinese_simplified_calculator/Rakefile +0 -6
- data/examples/danish_calculator/Rakefile +0 -6
- data/examples/estonian_calculator/Rakefile +0 -6
- data/examples/estonian_calculator/features/liitmine.feature +0 -16
- data/examples/norwegian_calculator/Rakefile +0 -6
- data/examples/portuguese_calculator/Rakefile +0 -6
- data/examples/spanish_calculator/Rakefile +0 -6
@@ -1,33 +1,33 @@
|
|
1
|
-
module Cucumber
|
2
|
-
|
3
|
-
|
4
|
-
module Feature
|
1
|
+
module Cucumber
|
2
|
+
# :stopdoc:
|
3
|
+
module TreetopParser
|
4
|
+
module Feature
|
5
5
|
include Treetop::Runtime
|
6
6
|
|
7
|
-
def root
|
7
|
+
def root
|
8
8
|
@root || :root
|
9
9
|
end
|
10
10
|
|
11
|
-
module Root0
|
12
|
-
def header
|
11
|
+
module Root0
|
12
|
+
def header
|
13
13
|
elements[1]
|
14
14
|
end
|
15
15
|
|
16
|
-
def scenario_sequence
|
16
|
+
def scenario_sequence
|
17
17
|
elements[2]
|
18
18
|
end
|
19
19
|
|
20
20
|
end
|
21
21
|
|
22
|
-
module Root1
|
23
|
-
def compile
|
22
|
+
module Root1
|
23
|
+
def compile
|
24
24
|
feature = Tree::Feature.new(header.text_value.strip)
|
25
25
|
scenario_sequence.compile(feature)
|
26
26
|
feature
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
def _nt_root
|
30
|
+
def _nt_root
|
31
31
|
start_index = index
|
32
32
|
if node_cache[:root].has_key?(index)
|
33
33
|
cached = node_cache[:root][index]
|
@@ -74,10 +74,10 @@ module Feature #:nodoc:
|
|
74
74
|
return r0
|
75
75
|
end
|
76
76
|
|
77
|
-
module Header0
|
77
|
+
module Header0
|
78
78
|
end
|
79
79
|
|
80
|
-
def _nt_header
|
80
|
+
def _nt_header
|
81
81
|
start_index = index
|
82
82
|
if node_cache[:header].has_key?(index)
|
83
83
|
cached = node_cache[:header][index]
|
@@ -144,39 +144,39 @@ module Feature #:nodoc:
|
|
144
144
|
return r0
|
145
145
|
end
|
146
146
|
|
147
|
-
module ScenarioSequence0
|
148
|
-
def space
|
147
|
+
module ScenarioSequence0
|
148
|
+
def space
|
149
149
|
elements[0]
|
150
150
|
end
|
151
151
|
|
152
|
-
def scenario_or_table
|
152
|
+
def scenario_or_table
|
153
153
|
elements[1]
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
module ScenarioSequence1
|
158
|
-
def head
|
157
|
+
module ScenarioSequence1
|
158
|
+
def head
|
159
159
|
elements[0]
|
160
160
|
end
|
161
161
|
|
162
|
-
def tail
|
162
|
+
def tail
|
163
163
|
elements[1]
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
167
|
-
module ScenarioSequence2
|
168
|
-
def compile(feature)
|
167
|
+
module ScenarioSequence2
|
168
|
+
def compile(feature)
|
169
169
|
([head] + tail).each do |scenario_or_table|
|
170
170
|
scenario_or_table.compile(feature) if scenario_or_table.respond_to?(:compile)
|
171
171
|
end
|
172
172
|
end
|
173
173
|
|
174
|
-
def tail
|
174
|
+
def tail
|
175
175
|
super.elements.map { |elt| elt.scenario_or_table }
|
176
176
|
end
|
177
177
|
end
|
178
178
|
|
179
|
-
def _nt_scenario_sequence
|
179
|
+
def _nt_scenario_sequence
|
180
180
|
start_index = index
|
181
181
|
if node_cache[:scenario_sequence].has_key?(index)
|
182
182
|
cached = node_cache[:scenario_sequence][index]
|
@@ -232,32 +232,32 @@ module Feature #:nodoc:
|
|
232
232
|
return r0
|
233
233
|
end
|
234
234
|
|
235
|
-
module Scenario0
|
236
|
-
def space
|
235
|
+
module Scenario0
|
236
|
+
def space
|
237
237
|
elements[0]
|
238
238
|
end
|
239
239
|
|
240
|
-
def step_sequence
|
240
|
+
def step_sequence
|
241
241
|
elements[1]
|
242
242
|
end
|
243
243
|
end
|
244
244
|
|
245
|
-
module Scenario1
|
246
|
-
def scenario_keyword
|
245
|
+
module Scenario1
|
246
|
+
def scenario_keyword
|
247
247
|
elements[0]
|
248
248
|
end
|
249
249
|
|
250
|
-
def name
|
250
|
+
def name
|
251
251
|
elements[2]
|
252
252
|
end
|
253
253
|
|
254
|
-
def steps
|
254
|
+
def steps
|
255
255
|
elements[3]
|
256
256
|
end
|
257
257
|
end
|
258
258
|
|
259
|
-
module Scenario2
|
260
|
-
def compile(feature)
|
259
|
+
module Scenario2
|
260
|
+
def compile(feature)
|
261
261
|
line = input.line_of(interval.first)
|
262
262
|
scenario = feature.add_scenario(name.text_value.strip, line)
|
263
263
|
steps.step_sequence.compile(scenario) if steps.respond_to?(:step_sequence)
|
@@ -267,7 +267,7 @@ module Feature #:nodoc:
|
|
267
267
|
end
|
268
268
|
end
|
269
269
|
|
270
|
-
def _nt_scenario
|
270
|
+
def _nt_scenario
|
271
271
|
start_index = index
|
272
272
|
if node_cache[:scenario].has_key?(index)
|
273
273
|
cached = node_cache[:scenario][index]
|
@@ -327,7 +327,7 @@ module Feature #:nodoc:
|
|
327
327
|
return r0
|
328
328
|
end
|
329
329
|
|
330
|
-
def _nt_scenario_or_table
|
330
|
+
def _nt_scenario_or_table
|
331
331
|
start_index = index
|
332
332
|
if node_cache[:scenario_or_table].has_key?(index)
|
333
333
|
cached = node_cache[:scenario_or_table][index]
|
@@ -354,27 +354,23 @@ module Feature #:nodoc:
|
|
354
354
|
return r0
|
355
355
|
end
|
356
356
|
|
357
|
-
module MoreExamples0
|
358
|
-
def more_examples_keyword
|
357
|
+
module MoreExamples0
|
358
|
+
def more_examples_keyword
|
359
359
|
elements[0]
|
360
360
|
end
|
361
361
|
|
362
|
-
def
|
362
|
+
def table
|
363
363
|
elements[1]
|
364
364
|
end
|
365
|
-
|
366
|
-
def table #:nodoc:
|
367
|
-
elements[2]
|
368
|
-
end
|
369
365
|
end
|
370
366
|
|
371
|
-
module MoreExamples1
|
372
|
-
def compile(f)
|
367
|
+
module MoreExamples1
|
368
|
+
def compile(f)
|
373
369
|
table.compile(f)
|
374
370
|
end
|
375
371
|
end
|
376
372
|
|
377
|
-
def _nt_more_examples
|
373
|
+
def _nt_more_examples
|
378
374
|
start_index = index
|
379
375
|
if node_cache[:more_examples].has_key?(index)
|
380
376
|
cached = node_cache[:more_examples][index]
|
@@ -386,12 +382,8 @@ module Feature #:nodoc:
|
|
386
382
|
r1 = _nt_more_examples_keyword
|
387
383
|
s0 << r1
|
388
384
|
if r1
|
389
|
-
r2 =
|
385
|
+
r2 = _nt_table
|
390
386
|
s0 << r2
|
391
|
-
if r2
|
392
|
-
r3 = _nt_table
|
393
|
-
s0 << r3
|
394
|
-
end
|
395
387
|
end
|
396
388
|
if s0.last
|
397
389
|
r0 = (SyntaxNode).new(input, i0...index, s0)
|
@@ -407,50 +399,54 @@ module Feature #:nodoc:
|
|
407
399
|
return r0
|
408
400
|
end
|
409
401
|
|
410
|
-
module Table0
|
411
|
-
def eol
|
402
|
+
module Table0
|
403
|
+
def eol
|
412
404
|
elements[1]
|
413
405
|
end
|
414
406
|
|
415
|
-
def table_line
|
407
|
+
def table_line
|
416
408
|
elements[3]
|
417
409
|
end
|
418
410
|
end
|
419
411
|
|
420
|
-
module Table1
|
421
|
-
def
|
412
|
+
module Table1
|
413
|
+
def space
|
422
414
|
elements[0]
|
423
415
|
end
|
424
416
|
|
425
|
-
def
|
417
|
+
def head
|
426
418
|
elements[1]
|
427
419
|
end
|
420
|
+
|
421
|
+
def body
|
422
|
+
elements[2]
|
423
|
+
end
|
428
424
|
end
|
429
425
|
|
430
|
-
module Table2
|
431
|
-
def compile(feature)
|
426
|
+
module Table2
|
427
|
+
def compile(feature)
|
432
428
|
Feature.last_scenario.table_header = head.cell_values
|
433
429
|
body.each do |table_line|
|
434
430
|
feature.add_row_scenario(Feature.last_scenario, table_line.cell_values, table_line.line)
|
435
431
|
end
|
436
432
|
end
|
437
433
|
|
438
|
-
def matrix
|
434
|
+
def matrix
|
439
435
|
([head] + body).map do |table_line|
|
440
|
-
table_line.cell_values # We're losing the line - we'll get it back when we make our own class
|
436
|
+
table_line.cell_values # We're losing the line - we'll get it back when we make our own class
|
441
437
|
end
|
442
438
|
end
|
443
439
|
|
444
|
-
def to_arg
|
440
|
+
def to_arg
|
445
441
|
Model::Table.new(matrix)
|
446
442
|
end
|
447
443
|
|
448
|
-
def body
|
444
|
+
def body
|
449
445
|
super.elements.map { |elt| elt.table_line }
|
450
446
|
end
|
451
447
|
end
|
452
448
|
|
453
|
-
def _nt_table
|
449
|
+
def _nt_table
|
454
450
|
start_index = index
|
455
451
|
if node_cache[:table].has_key?(index)
|
456
452
|
cached = node_cache[:table][index]
|
@@ -459,55 +455,59 @@ module Feature #:nodoc:
|
|
459
455
|
end
|
460
456
|
|
461
457
|
i0, s0 = index, []
|
462
|
-
r1 =
|
458
|
+
r1 = _nt_space
|
463
459
|
s0 << r1
|
464
460
|
if r1
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
461
|
+
r2 = _nt_table_line
|
462
|
+
s0 << r2
|
463
|
+
if r2
|
464
|
+
s3, i3 = [], index
|
469
465
|
loop do
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
end
|
477
|
-
r4 = SyntaxNode.new(input, i4...index, s4)
|
478
|
-
s3 << r4
|
479
|
-
if r4
|
480
|
-
r6 = _nt_eol
|
481
|
-
s3 << r6
|
482
|
-
if r6
|
483
|
-
r8 = _nt_space
|
484
|
-
if r8
|
485
|
-
r7 = r8
|
466
|
+
i4, s4 = index, []
|
467
|
+
s5, i5 = [], index
|
468
|
+
loop do
|
469
|
+
r6 = _nt_blank
|
470
|
+
if r6
|
471
|
+
s5 << r6
|
486
472
|
else
|
487
|
-
|
473
|
+
break
|
488
474
|
end
|
489
|
-
|
475
|
+
end
|
476
|
+
r5 = SyntaxNode.new(input, i5...index, s5)
|
477
|
+
s4 << r5
|
478
|
+
if r5
|
479
|
+
r7 = _nt_eol
|
480
|
+
s4 << r7
|
490
481
|
if r7
|
491
|
-
r9 =
|
492
|
-
|
482
|
+
r9 = _nt_space
|
483
|
+
if r9
|
484
|
+
r8 = r9
|
485
|
+
else
|
486
|
+
r8 = SyntaxNode.new(input, index...index)
|
487
|
+
end
|
488
|
+
s4 << r8
|
489
|
+
if r8
|
490
|
+
r10 = _nt_table_line
|
491
|
+
s4 << r10
|
492
|
+
end
|
493
493
|
end
|
494
494
|
end
|
495
|
+
if s4.last
|
496
|
+
r4 = (SyntaxNode).new(input, i4...index, s4)
|
497
|
+
r4.extend(Table0)
|
498
|
+
else
|
499
|
+
self.index = i4
|
500
|
+
r4 = nil
|
501
|
+
end
|
502
|
+
if r4
|
503
|
+
s3 << r4
|
504
|
+
else
|
505
|
+
break
|
506
|
+
end
|
495
507
|
end
|
496
|
-
|
497
|
-
|
498
|
-
r3.extend(Table0)
|
499
|
-
else
|
500
|
-
self.index = i3
|
501
|
-
r3 = nil
|
502
|
-
end
|
503
|
-
if r3
|
504
|
-
s2 << r3
|
505
|
-
else
|
506
|
-
break
|
507
|
-
end
|
508
|
+
r3 = SyntaxNode.new(input, i3...index, s3)
|
509
|
+
s0 << r3
|
508
510
|
end
|
509
|
-
r2 = SyntaxNode.new(input, i2...index, s2)
|
510
|
-
s0 << r2
|
511
511
|
end
|
512
512
|
if s0.last
|
513
513
|
r0 = (SyntaxNode).new(input, i0...index, s0)
|
@@ -523,37 +523,37 @@ module Feature #:nodoc:
|
|
523
523
|
return r0
|
524
524
|
end
|
525
525
|
|
526
|
-
module TableLine0
|
527
|
-
def cell_value
|
526
|
+
module TableLine0
|
527
|
+
def cell_value
|
528
528
|
elements[1]
|
529
529
|
end
|
530
530
|
|
531
|
-
def separator
|
531
|
+
def separator
|
532
532
|
elements[3]
|
533
533
|
end
|
534
534
|
end
|
535
535
|
|
536
|
-
module TableLine1
|
537
|
-
def separator
|
536
|
+
module TableLine1
|
537
|
+
def separator
|
538
538
|
elements[0]
|
539
539
|
end
|
540
540
|
|
541
|
-
def cells
|
541
|
+
def cells
|
542
542
|
elements[1]
|
543
543
|
end
|
544
544
|
end
|
545
545
|
|
546
|
-
module TableLine2
|
547
|
-
def cell_values
|
546
|
+
module TableLine2
|
547
|
+
def cell_values
|
548
548
|
cells.elements.map { |elt| elt.cell_value.text_value.strip }
|
549
549
|
end
|
550
550
|
|
551
|
-
def line
|
551
|
+
def line
|
552
552
|
input.line_of(interval.first)
|
553
553
|
end
|
554
554
|
end
|
555
555
|
|
556
|
-
def _nt_table_line
|
556
|
+
def _nt_table_line
|
557
557
|
start_index = index
|
558
558
|
if node_cache[:table_line].has_key?(index)
|
559
559
|
cached = node_cache[:table_line][index]
|
@@ -635,10 +635,10 @@ module Feature #:nodoc:
|
|
635
635
|
return r0
|
636
636
|
end
|
637
637
|
|
638
|
-
module CellValue0
|
638
|
+
module CellValue0
|
639
639
|
end
|
640
640
|
|
641
|
-
def _nt_cell_value
|
641
|
+
def _nt_cell_value
|
642
642
|
start_index = index
|
643
643
|
if node_cache[:cell_value].has_key?(index)
|
644
644
|
cached = node_cache[:cell_value][index]
|
@@ -700,39 +700,39 @@ module Feature #:nodoc:
|
|
700
700
|
return r0
|
701
701
|
end
|
702
702
|
|
703
|
-
module StepSequence0
|
704
|
-
def space
|
703
|
+
module StepSequence0
|
704
|
+
def space
|
705
705
|
elements[0]
|
706
706
|
end
|
707
707
|
|
708
|
-
def step
|
708
|
+
def step
|
709
709
|
elements[1]
|
710
710
|
end
|
711
711
|
end
|
712
712
|
|
713
|
-
module StepSequence1
|
714
|
-
def head
|
713
|
+
module StepSequence1
|
714
|
+
def head
|
715
715
|
elements[0]
|
716
716
|
end
|
717
717
|
|
718
|
-
def tail
|
718
|
+
def tail
|
719
719
|
elements[1]
|
720
720
|
end
|
721
721
|
end
|
722
722
|
|
723
|
-
module StepSequence2
|
724
|
-
def compile(scenario)
|
723
|
+
module StepSequence2
|
724
|
+
def compile(scenario)
|
725
725
|
([head] + tail).each do |step|
|
726
726
|
step.compile(scenario)
|
727
727
|
end
|
728
728
|
end
|
729
729
|
|
730
|
-
def tail
|
730
|
+
def tail
|
731
731
|
super.elements.map { |elt| elt.step }
|
732
732
|
end
|
733
733
|
end
|
734
734
|
|
735
|
-
def _nt_step_sequence
|
735
|
+
def _nt_step_sequence
|
736
736
|
start_index = index
|
737
737
|
if node_cache[:step_sequence].has_key?(index)
|
738
738
|
cached = node_cache[:step_sequence][index]
|
@@ -783,7 +783,7 @@ module Feature #:nodoc:
|
|
783
783
|
return r0
|
784
784
|
end
|
785
785
|
|
786
|
-
def _nt_step
|
786
|
+
def _nt_step
|
787
787
|
start_index = index
|
788
788
|
if node_cache[:step].has_key?(index)
|
789
789
|
cached = node_cache[:step][index]
|
@@ -810,24 +810,24 @@ module Feature #:nodoc:
|
|
810
810
|
return r0
|
811
811
|
end
|
812
812
|
|
813
|
-
module GivenScenario0
|
814
|
-
def given_scenario_keyword
|
813
|
+
module GivenScenario0
|
814
|
+
def given_scenario_keyword
|
815
815
|
elements[0]
|
816
816
|
end
|
817
817
|
|
818
|
-
def name
|
818
|
+
def name
|
819
819
|
elements[2]
|
820
820
|
end
|
821
821
|
end
|
822
822
|
|
823
|
-
module GivenScenario1
|
824
|
-
def compile(scenario)
|
823
|
+
module GivenScenario1
|
824
|
+
def compile(scenario)
|
825
825
|
line = input.line_of(interval.first)
|
826
826
|
scenario.create_given_scenario(name.text_value.strip, line)
|
827
827
|
end
|
828
828
|
end
|
829
829
|
|
830
|
-
def _nt_given_scenario
|
830
|
+
def _nt_given_scenario
|
831
831
|
start_index = index
|
832
832
|
if node_cache[:given_scenario].has_key?(index)
|
833
833
|
cached = node_cache[:given_scenario][index]
|
@@ -865,41 +865,32 @@ module Feature #:nodoc:
|
|
865
865
|
return r0
|
866
866
|
end
|
867
867
|
|
868
|
-
module PlainStep0
|
869
|
-
def
|
868
|
+
module PlainStep0
|
869
|
+
def step_keyword
|
870
870
|
elements[0]
|
871
871
|
end
|
872
872
|
|
873
|
-
def
|
874
|
-
elements[1]
|
875
|
-
end
|
876
|
-
end
|
877
|
-
|
878
|
-
module PlainStep1 #:nodoc:
|
879
|
-
def step_keyword #:nodoc:
|
880
|
-
elements[0]
|
881
|
-
end
|
882
|
-
|
883
|
-
def name #:nodoc:
|
873
|
+
def name
|
884
874
|
elements[2]
|
885
875
|
end
|
886
876
|
|
887
|
-
def multi
|
877
|
+
def multi
|
888
878
|
elements[3]
|
889
879
|
end
|
890
880
|
end
|
891
881
|
|
892
|
-
module
|
893
|
-
def compile(scenario)
|
882
|
+
module PlainStep1
|
883
|
+
def compile(scenario)
|
894
884
|
line = input.line_of(interval.first)
|
895
885
|
step = scenario.create_step(step_keyword.text_value, name.text_value.strip, line)
|
896
|
-
|
897
|
-
|
886
|
+
|
887
|
+
if multi.respond_to?(:to_arg)
|
888
|
+
step.extra_args << multi.to_arg
|
898
889
|
end
|
899
890
|
end
|
900
891
|
end
|
901
892
|
|
902
|
-
def _nt_plain_step
|
893
|
+
def _nt_plain_step
|
903
894
|
start_index = index
|
904
895
|
if node_cache[:plain_step].has_key?(index)
|
905
896
|
cached = node_cache[:plain_step][index]
|
@@ -922,20 +913,7 @@ module Feature #:nodoc:
|
|
922
913
|
r4 = _nt_line_to_eol
|
923
914
|
s0 << r4
|
924
915
|
if r4
|
925
|
-
|
926
|
-
r7 = _nt_space
|
927
|
-
s6 << r7
|
928
|
-
if r7
|
929
|
-
r8 = _nt_multiline_arg
|
930
|
-
s6 << r8
|
931
|
-
end
|
932
|
-
if s6.last
|
933
|
-
r6 = (SyntaxNode).new(input, i6...index, s6)
|
934
|
-
r6.extend(PlainStep0)
|
935
|
-
else
|
936
|
-
self.index = i6
|
937
|
-
r6 = nil
|
938
|
-
end
|
916
|
+
r6 = _nt_multiline_arg
|
939
917
|
if r6
|
940
918
|
r5 = r6
|
941
919
|
else
|
@@ -947,8 +925,8 @@ module Feature #:nodoc:
|
|
947
925
|
end
|
948
926
|
if s0.last
|
949
927
|
r0 = (SyntaxNode).new(input, i0...index, s0)
|
928
|
+
r0.extend(PlainStep0)
|
950
929
|
r0.extend(PlainStep1)
|
951
|
-
r0.extend(PlainStep2)
|
952
930
|
else
|
953
931
|
self.index = i0
|
954
932
|
r0 = nil
|
@@ -959,7 +937,7 @@ module Feature #:nodoc:
|
|
959
937
|
return r0
|
960
938
|
end
|
961
939
|
|
962
|
-
def _nt_multiline_arg
|
940
|
+
def _nt_multiline_arg
|
963
941
|
start_index = index
|
964
942
|
if node_cache[:multiline_arg].has_key?(index)
|
965
943
|
cached = node_cache[:multiline_arg][index]
|
@@ -986,30 +964,42 @@ module Feature #:nodoc:
|
|
986
964
|
return r0
|
987
965
|
end
|
988
966
|
|
989
|
-
module MultilineString0
|
967
|
+
module MultilineString0
|
990
968
|
end
|
991
969
|
|
992
|
-
module MultilineString1
|
993
|
-
def
|
970
|
+
module MultilineString1
|
971
|
+
def eol
|
994
972
|
elements[0]
|
995
973
|
end
|
996
974
|
|
997
|
-
def
|
975
|
+
def indent
|
998
976
|
elements[1]
|
999
977
|
end
|
1000
978
|
|
1001
|
-
def
|
979
|
+
def triple_quote
|
1002
980
|
elements[2]
|
1003
981
|
end
|
982
|
+
|
983
|
+
def string
|
984
|
+
elements[3]
|
985
|
+
end
|
986
|
+
|
987
|
+
def triple_quote
|
988
|
+
elements[4]
|
989
|
+
end
|
1004
990
|
end
|
1005
991
|
|
1006
|
-
module MultilineString2
|
1007
|
-
def to_arg
|
1008
|
-
|
992
|
+
module MultilineString2
|
993
|
+
def to_arg
|
994
|
+
indent_length = indent.text_value.length
|
995
|
+
significant_lines = string.text_value.split("\n")[1..-2]
|
996
|
+
significant_lines.map do |l|
|
997
|
+
l[indent_length..-1]
|
998
|
+
end.join("\n")
|
1009
999
|
end
|
1010
1000
|
end
|
1011
1001
|
|
1012
|
-
def _nt_multiline_string
|
1002
|
+
def _nt_multiline_string
|
1013
1003
|
start_index = index
|
1014
1004
|
if node_cache[:multiline_string].has_key?(index)
|
1015
1005
|
cached = node_cache[:multiline_string][index]
|
@@ -1018,49 +1008,57 @@ module Feature #:nodoc:
|
|
1018
1008
|
end
|
1019
1009
|
|
1020
1010
|
i0, s0 = index, []
|
1021
|
-
r1 =
|
1011
|
+
r1 = _nt_eol
|
1022
1012
|
s0 << r1
|
1023
1013
|
if r1
|
1024
|
-
|
1025
|
-
loop do
|
1026
|
-
i3, s3 = index, []
|
1027
|
-
i4 = index
|
1028
|
-
r5 = _nt_quote
|
1029
|
-
if r5
|
1030
|
-
r4 = nil
|
1031
|
-
else
|
1032
|
-
self.index = i4
|
1033
|
-
r4 = SyntaxNode.new(input, index...index)
|
1034
|
-
end
|
1035
|
-
s3 << r4
|
1036
|
-
if r4
|
1037
|
-
if index < input_length
|
1038
|
-
r6 = (SyntaxNode).new(input, index...(index + 1))
|
1039
|
-
@index += 1
|
1040
|
-
else
|
1041
|
-
terminal_parse_failure("any character")
|
1042
|
-
r6 = nil
|
1043
|
-
end
|
1044
|
-
s3 << r6
|
1045
|
-
end
|
1046
|
-
if s3.last
|
1047
|
-
r3 = (SyntaxNode).new(input, i3...index, s3)
|
1048
|
-
r3.extend(MultilineString0)
|
1049
|
-
else
|
1050
|
-
self.index = i3
|
1051
|
-
r3 = nil
|
1052
|
-
end
|
1053
|
-
if r3
|
1054
|
-
s2 << r3
|
1055
|
-
else
|
1056
|
-
break
|
1057
|
-
end
|
1058
|
-
end
|
1059
|
-
r2 = SyntaxNode.new(input, i2...index, s2)
|
1014
|
+
r2 = _nt_space
|
1060
1015
|
s0 << r2
|
1061
1016
|
if r2
|
1062
|
-
|
1063
|
-
s0 <<
|
1017
|
+
r3 = _nt_triple_quote
|
1018
|
+
s0 << r3
|
1019
|
+
if r3
|
1020
|
+
s4, i4 = [], index
|
1021
|
+
loop do
|
1022
|
+
i5, s5 = index, []
|
1023
|
+
i6 = index
|
1024
|
+
r7 = _nt_triple_quote
|
1025
|
+
if r7
|
1026
|
+
r6 = nil
|
1027
|
+
else
|
1028
|
+
self.index = i6
|
1029
|
+
r6 = SyntaxNode.new(input, index...index)
|
1030
|
+
end
|
1031
|
+
s5 << r6
|
1032
|
+
if r6
|
1033
|
+
if index < input_length
|
1034
|
+
r8 = (SyntaxNode).new(input, index...(index + 1))
|
1035
|
+
@index += 1
|
1036
|
+
else
|
1037
|
+
terminal_parse_failure("any character")
|
1038
|
+
r8 = nil
|
1039
|
+
end
|
1040
|
+
s5 << r8
|
1041
|
+
end
|
1042
|
+
if s5.last
|
1043
|
+
r5 = (SyntaxNode).new(input, i5...index, s5)
|
1044
|
+
r5.extend(MultilineString0)
|
1045
|
+
else
|
1046
|
+
self.index = i5
|
1047
|
+
r5 = nil
|
1048
|
+
end
|
1049
|
+
if r5
|
1050
|
+
s4 << r5
|
1051
|
+
else
|
1052
|
+
break
|
1053
|
+
end
|
1054
|
+
end
|
1055
|
+
r4 = SyntaxNode.new(input, i4...index, s4)
|
1056
|
+
s0 << r4
|
1057
|
+
if r4
|
1058
|
+
r9 = _nt_triple_quote
|
1059
|
+
s0 << r9
|
1060
|
+
end
|
1061
|
+
end
|
1064
1062
|
end
|
1065
1063
|
end
|
1066
1064
|
if s0.last
|
@@ -1077,28 +1075,28 @@ module Feature #:nodoc:
|
|
1077
1075
|
return r0
|
1078
1076
|
end
|
1079
1077
|
|
1080
|
-
def
|
1078
|
+
def _nt_triple_quote
|
1081
1079
|
start_index = index
|
1082
|
-
if node_cache[:
|
1083
|
-
cached = node_cache[:
|
1080
|
+
if node_cache[:triple_quote].has_key?(index)
|
1081
|
+
cached = node_cache[:triple_quote][index]
|
1084
1082
|
@index = cached.interval.end if cached
|
1085
1083
|
return cached
|
1086
1084
|
end
|
1087
1085
|
|
1088
|
-
if input.index('"', index) == index
|
1089
|
-
r0 = (SyntaxNode).new(input, index...(index +
|
1090
|
-
@index +=
|
1086
|
+
if input.index('"""', index) == index
|
1087
|
+
r0 = (SyntaxNode).new(input, index...(index + 3))
|
1088
|
+
@index += 3
|
1091
1089
|
else
|
1092
|
-
terminal_parse_failure('"')
|
1090
|
+
terminal_parse_failure('"""')
|
1093
1091
|
r0 = nil
|
1094
1092
|
end
|
1095
1093
|
|
1096
|
-
node_cache[:
|
1094
|
+
node_cache[:triple_quote][start_index] = r0
|
1097
1095
|
|
1098
1096
|
return r0
|
1099
1097
|
end
|
1100
1098
|
|
1101
|
-
def _nt_separator
|
1099
|
+
def _nt_separator
|
1102
1100
|
start_index = index
|
1103
1101
|
if node_cache[:separator].has_key?(index)
|
1104
1102
|
cached = node_cache[:separator][index]
|
@@ -1119,7 +1117,7 @@ module Feature #:nodoc:
|
|
1119
1117
|
return r0
|
1120
1118
|
end
|
1121
1119
|
|
1122
|
-
def _nt_space
|
1120
|
+
def _nt_space
|
1123
1121
|
start_index = index
|
1124
1122
|
if node_cache[:space].has_key?(index)
|
1125
1123
|
cached = node_cache[:space][index]
|
@@ -1160,10 +1158,10 @@ module Feature #:nodoc:
|
|
1160
1158
|
return r0
|
1161
1159
|
end
|
1162
1160
|
|
1163
|
-
module LineToEol0
|
1161
|
+
module LineToEol0
|
1164
1162
|
end
|
1165
1163
|
|
1166
|
-
def _nt_line_to_eol
|
1164
|
+
def _nt_line_to_eol
|
1167
1165
|
start_index = index
|
1168
1166
|
if node_cache[:line_to_eol].has_key?(index)
|
1169
1167
|
cached = node_cache[:line_to_eol][index]
|
@@ -1213,13 +1211,13 @@ module Feature #:nodoc:
|
|
1213
1211
|
return r0
|
1214
1212
|
end
|
1215
1213
|
|
1216
|
-
module CommentToEol0
|
1217
|
-
def line_to_eol
|
1214
|
+
module CommentToEol0
|
1215
|
+
def line_to_eol
|
1218
1216
|
elements[1]
|
1219
1217
|
end
|
1220
1218
|
end
|
1221
1219
|
|
1222
|
-
def _nt_comment_to_eol
|
1220
|
+
def _nt_comment_to_eol
|
1223
1221
|
start_index = index
|
1224
1222
|
if node_cache[:comment_to_eol].has_key?(index)
|
1225
1223
|
cached = node_cache[:comment_to_eol][index]
|
@@ -1253,7 +1251,7 @@ module Feature #:nodoc:
|
|
1253
1251
|
return r0
|
1254
1252
|
end
|
1255
1253
|
|
1256
|
-
def _nt_white
|
1254
|
+
def _nt_white
|
1257
1255
|
start_index = index
|
1258
1256
|
if node_cache[:white].has_key?(index)
|
1259
1257
|
cached = node_cache[:white][index]
|
@@ -1280,7 +1278,7 @@ module Feature #:nodoc:
|
|
1280
1278
|
return r0
|
1281
1279
|
end
|
1282
1280
|
|
1283
|
-
def _nt_blank
|
1281
|
+
def _nt_blank
|
1284
1282
|
start_index = index
|
1285
1283
|
if node_cache[:blank].has_key?(index)
|
1286
1284
|
cached = node_cache[:blank][index]
|
@@ -1300,10 +1298,10 @@ module Feature #:nodoc:
|
|
1300
1298
|
return r0
|
1301
1299
|
end
|
1302
1300
|
|
1303
|
-
module Eol0
|
1301
|
+
module Eol0
|
1304
1302
|
end
|
1305
1303
|
|
1306
|
-
def _nt_eol
|
1304
|
+
def _nt_eol
|
1307
1305
|
start_index = index
|
1308
1306
|
if node_cache[:eol].has_key?(index)
|
1309
1307
|
cached = node_cache[:eol][index]
|
@@ -1366,7 +1364,7 @@ module Feature #:nodoc:
|
|
1366
1364
|
return r0
|
1367
1365
|
end
|
1368
1366
|
|
1369
|
-
def _nt_step_keyword
|
1367
|
+
def _nt_step_keyword
|
1370
1368
|
start_index = index
|
1371
1369
|
if node_cache[:step_keyword].has_key?(index)
|
1372
1370
|
cached = node_cache[:step_keyword][index]
|
@@ -1438,10 +1436,10 @@ module Feature #:nodoc:
|
|
1438
1436
|
return r0
|
1439
1437
|
end
|
1440
1438
|
|
1441
|
-
module ScenarioKeyword0
|
1439
|
+
module ScenarioKeyword0
|
1442
1440
|
end
|
1443
1441
|
|
1444
|
-
def _nt_scenario_keyword
|
1442
|
+
def _nt_scenario_keyword
|
1445
1443
|
start_index = index
|
1446
1444
|
if node_cache[:scenario_keyword].has_key?(index)
|
1447
1445
|
cached = node_cache[:scenario_keyword][index]
|
@@ -1486,10 +1484,10 @@ module Feature #:nodoc:
|
|
1486
1484
|
return r0
|
1487
1485
|
end
|
1488
1486
|
|
1489
|
-
module MoreExamplesKeyword0
|
1487
|
+
module MoreExamplesKeyword0
|
1490
1488
|
end
|
1491
1489
|
|
1492
|
-
def _nt_more_examples_keyword
|
1490
|
+
def _nt_more_examples_keyword
|
1493
1491
|
start_index = index
|
1494
1492
|
if node_cache[:more_examples_keyword].has_key?(index)
|
1495
1493
|
cached = node_cache[:more_examples_keyword][index]
|
@@ -1534,10 +1532,10 @@ module Feature #:nodoc:
|
|
1534
1532
|
return r0
|
1535
1533
|
end
|
1536
1534
|
|
1537
|
-
module GivenScenarioKeyword0
|
1535
|
+
module GivenScenarioKeyword0
|
1538
1536
|
end
|
1539
1537
|
|
1540
|
-
def _nt_given_scenario_keyword
|
1538
|
+
def _nt_given_scenario_keyword
|
1541
1539
|
start_index = index
|
1542
1540
|
if node_cache[:given_scenario_keyword].has_key?(index)
|
1543
1541
|
cached = node_cache[:given_scenario_keyword][index]
|
@@ -1584,7 +1582,7 @@ module Feature #:nodoc:
|
|
1584
1582
|
|
1585
1583
|
end
|
1586
1584
|
|
1587
|
-
class FeatureParser < Treetop::Runtime::CompiledParser
|
1585
|
+
class FeatureParser < Treetop::Runtime::CompiledParser
|
1588
1586
|
include Feature
|
1589
1587
|
end
|
1590
1588
|
|