aslakhellesoy-cucumber 0.1.12 → 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. data/History.txt +38 -3
  2. data/Manifest.txt +17 -1
  3. data/README.txt +2 -39
  4. data/bin/cucumber +1 -1
  5. data/examples/calculator_ruby_features/features/addition.rb +16 -0
  6. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -1
  7. data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -0
  8. data/examples/i18n/de/features/step_definitons/calculator_steps.rb +1 -0
  9. data/examples/i18n/en/features/step_definitons/calculator_steps.rb +1 -0
  10. data/examples/i18n/es/features/step_definitons/calculador_steps.rb +1 -0
  11. data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +1 -0
  12. data/examples/i18n/fr/features/addition.feature +13 -11
  13. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +6 -2
  14. data/examples/i18n/id/features/step_definitons/calculator_steps.rb +1 -0
  15. data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -0
  16. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +2 -0
  17. data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +1 -0
  18. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +1 -0
  19. data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -0
  20. data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -0
  21. data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -0
  22. data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +1 -0
  23. data/examples/selenium/features/search.feature +1 -1
  24. data/examples/selenium/features/step_definitons/stories_steps.rb +2 -3
  25. data/examples/tickets/features/lib/eatting_machine.rb +18 -0
  26. data/examples/tickets/features/lib/pantry.rb +20 -0
  27. data/examples/tickets/features/scenario_outline.feature +64 -0
  28. data/examples/tickets/features/step_definitons/scenario_outline_steps.rb +34 -0
  29. data/examples/tickets/features/step_definitons/tickets_steps.rb +4 -0
  30. data/gem_tasks/fix_cr_lf.rake +1 -1
  31. data/gem_tasks/yard.rake +8 -0
  32. data/lib/autotest/cucumber_mixin.rb +3 -3
  33. data/lib/cucumber/broadcaster.rb +1 -1
  34. data/lib/cucumber/cli.rb +87 -42
  35. data/lib/cucumber/core_ext/exception.rb +20 -0
  36. data/lib/cucumber/core_ext/string.rb +1 -1
  37. data/lib/cucumber/executor.rb +35 -18
  38. data/lib/cucumber/formatters/ansicolor.rb +65 -74
  39. data/lib/cucumber/formatters/html_formatter.rb +33 -10
  40. data/lib/cucumber/formatters/pretty_formatter.rb +58 -16
  41. data/lib/cucumber/formatters/progress_formatter.rb +3 -0
  42. data/lib/cucumber/formatters/unicode.rb +27 -0
  43. data/lib/cucumber/languages.yml +6 -4
  44. data/lib/cucumber/platform.rb +1 -0
  45. data/lib/cucumber/rails/world.rb +6 -6
  46. data/lib/cucumber/step_mother.rb +3 -0
  47. data/lib/cucumber/tree/feature.rb +28 -2
  48. data/lib/cucumber/tree/scenario.rb +62 -1
  49. data/lib/cucumber/tree/step.rb +32 -1
  50. data/lib/cucumber/treetop_parser/feature.treetop.erb +54 -7
  51. data/lib/cucumber/treetop_parser/feature_ar.rb +377 -18
  52. data/lib/cucumber/treetop_parser/feature_cy.rb +377 -18
  53. data/lib/cucumber/treetop_parser/feature_da.rb +377 -18
  54. data/lib/cucumber/treetop_parser/feature_de.rb +377 -18
  55. data/lib/cucumber/treetop_parser/feature_en-lol.rb +377 -18
  56. data/lib/cucumber/treetop_parser/feature_en-tx.rb +377 -18
  57. data/lib/cucumber/treetop_parser/feature_en.rb +377 -18
  58. data/lib/cucumber/treetop_parser/feature_es.rb +377 -18
  59. data/lib/cucumber/treetop_parser/feature_et.rb +377 -18
  60. data/lib/cucumber/treetop_parser/feature_fr.rb +389 -30
  61. data/lib/cucumber/treetop_parser/feature_id.rb +377 -18
  62. data/lib/cucumber/treetop_parser/feature_it.rb +377 -18
  63. data/lib/cucumber/treetop_parser/feature_ja.rb +377 -18
  64. data/lib/cucumber/treetop_parser/feature_lt.rb +377 -18
  65. data/lib/cucumber/treetop_parser/feature_nl.rb +377 -18
  66. data/lib/cucumber/treetop_parser/feature_no.rb +377 -18
  67. data/lib/cucumber/treetop_parser/feature_pl.rb +377 -18
  68. data/lib/cucumber/treetop_parser/feature_pt.rb +377 -18
  69. data/lib/cucumber/treetop_parser/feature_ro.rb +377 -18
  70. data/lib/cucumber/treetop_parser/feature_ro2.rb +377 -18
  71. data/lib/cucumber/treetop_parser/feature_ru.rb +377 -18
  72. data/lib/cucumber/treetop_parser/feature_se.rb +377 -18
  73. data/lib/cucumber/treetop_parser/feature_zh-CN.rb +377 -18
  74. data/lib/cucumber/version.rb +1 -1
  75. data/lib/cucumber/world/pending.rb +22 -0
  76. data/lib/cucumber/world.rb +1 -0
  77. data/lib/cucumber.rb +2 -0
  78. data/rails_generators/cucumber/templates/env.rb +1 -0
  79. data/rails_generators/feature/feature_generator.rb +22 -2
  80. data/rails_generators/feature/templates/feature.erb +15 -12
  81. data/rails_generators/feature/templates/steps.erb +16 -14
  82. data/spec/cucumber/cli_spec.rb +87 -6
  83. data/spec/cucumber/executor_spec.rb +102 -30
  84. data/spec/cucumber/formatters/ansicolor_spec.rb +10 -10
  85. data/spec/cucumber/formatters/html_formatter_spec.rb +30 -0
  86. data/spec/cucumber/formatters/pretty_formatter_spec.rb +139 -4
  87. data/spec/cucumber/formatters/progress_formatter_spec.rb +16 -0
  88. data/spec/cucumber/tree/feature_spec.rb +84 -5
  89. data/spec/cucumber/tree/row_scenario_outline_spec.rb +73 -0
  90. data/spec/cucumber/tree/row_step_outline_spec.rb +38 -0
  91. data/spec/cucumber/tree/scenario_outline_spec.rb +50 -0
  92. data/spec/cucumber/tree/step_outline_spec.rb +17 -0
  93. data/spec/cucumber/tree/step_spec.rb +9 -0
  94. data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +3 -0
  95. data/spec/cucumber/treetop_parser/feature_parser_spec.rb +22 -0
  96. data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +7 -0
  97. data/spec/cucumber/treetop_parser/scenario_outline.feature +16 -0
  98. data/spec/cucumber/world/pending_spec.rb +46 -0
  99. data/spec/spec_helper.rb +2 -1
  100. metadata +19 -4
  101. data/TODO.txt +0 -26
@@ -94,12 +94,17 @@ module Feature
94
94
  if r4
95
95
  r3 = r4
96
96
  else
97
- r5 = _nt_comment_to_eol
97
+ r5 = _nt_scenario_outline_keyword
98
98
  if r5
99
99
  r3 = r5
100
100
  else
101
- self.index = i3
102
- r3 = nil
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
- r6 = (SyntaxNode).new(input, index...(index + 1))
119
+ r7 = (SyntaxNode).new(input, index...(index + 1))
115
120
  @index += 1
116
121
  else
117
122
  terminal_parse_failure("any character")
118
- r6 = nil
123
+ r7 = nil
119
124
  end
120
- s1 << r6
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 scenario_or_table
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 |scenario_or_table|
170
- scenario_or_table.compile(feature) if scenario_or_table.respond_to?(:compile)
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.scenario_or_table }
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 = _nt_scenario
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 = _nt_scenario_or_table
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
- def _nt_scenario_or_table
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
386
+ start_index = index
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
331
433
  start_index = index
332
- if node_cache[:scenario_or_table].has_key?(index)
333
- cached = node_cache[:scenario_or_table][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 = _nt_scenario
441
+ r1 = _nt_scenario_outline
340
442
  if r1
341
443
  r0 = r1
342
444
  else
343
- r2 = _nt_more_examples
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[:scenario_or_table][start_index] = r0
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