cucumber 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/History.txt +53 -0
  2. data/Manifest.txt +4 -0
  3. data/Rakefile +1 -0
  4. data/examples/calculator/cucumber.yml +1 -1
  5. data/examples/dos_line_endings/Rakefile +6 -0
  6. data/examples/dos_line_endings/features/dos_line_endings.feature +9 -0
  7. data/examples/tickets/features/steps/tickets_steps.rb +13 -1
  8. data/examples/tickets/features/tickets.feature +5 -1
  9. data/gem_tasks/treetop.rake +10 -0
  10. data/generators/cucumber/templates/common_webrat.rb +1 -1
  11. data/lib/cucumber.rb +3 -1
  12. data/lib/cucumber/cli.rb +16 -15
  13. data/lib/cucumber/core_ext/proc.rb +11 -2
  14. data/lib/cucumber/executor.rb +32 -15
  15. data/lib/cucumber/formatters/ansicolor.rb +25 -3
  16. data/lib/cucumber/formatters/pretty_formatter.rb +44 -15
  17. data/lib/cucumber/languages.yml +10 -0
  18. data/lib/cucumber/step_methods.rb +8 -4
  19. data/lib/cucumber/step_mother.rb +4 -3
  20. data/lib/cucumber/tree/scenario.rb +22 -10
  21. data/lib/cucumber/tree/step.rb +9 -1
  22. data/lib/cucumber/treetop_parser/feature.treetop.erb +5 -5
  23. data/lib/cucumber/treetop_parser/feature_da.rb +146 -108
  24. data/lib/cucumber/treetop_parser/feature_de.rb +146 -108
  25. data/lib/cucumber/treetop_parser/feature_en.rb +146 -108
  26. data/lib/cucumber/treetop_parser/feature_es.rb +146 -108
  27. data/lib/cucumber/treetop_parser/feature_et.rb +146 -108
  28. data/lib/cucumber/treetop_parser/feature_fr.rb +146 -108
  29. data/lib/cucumber/treetop_parser/feature_no.rb +146 -108
  30. data/lib/cucumber/treetop_parser/feature_parser.rb +4 -2
  31. data/lib/cucumber/treetop_parser/feature_pt.rb +146 -108
  32. data/lib/cucumber/treetop_parser/feature_ru.rb +146 -108
  33. data/lib/cucumber/treetop_parser/feature_se.rb +146 -108
  34. data/lib/cucumber/version.rb +1 -1
  35. data/spec/cucumber/cli_spec.rb +14 -4
  36. data/spec/cucumber/executor_spec.rb +4 -3
  37. data/spec/cucumber/formatters/ansicolor_spec.rb +4 -0
  38. data/spec/cucumber/formatters/pretty_formatter_spec.rb +67 -2
  39. data/spec/cucumber/tree/scenario_spec.rb +2 -2
  40. data/spec/cucumber/tree/step_spec.rb +21 -0
  41. data/spec/cucumber/treetop_parser/feature_parser_spec.rb +5 -0
  42. data/spec/cucumber/treetop_parser/test_dos.feature +24 -0
  43. data/spec/spec_helper.rb +1 -7
  44. metadata +6 -2
@@ -1,33 +1,33 @@
1
- module Cucumber
2
- module TreetopParser
1
+ module Cucumber #:nodoc:
2
+ module TreetopParser #:nodoc:
3
3
 
4
- module Feature
4
+ module Feature #:nodoc:
5
5
  include Treetop::Runtime
6
6
 
7
- def root
7
+ def root #:nodoc:
8
8
  @root || :root
9
9
  end
10
10
 
11
- module Root0
12
- def header
11
+ module Root0 #:nodoc:
12
+ def header #:nodoc:
13
13
  elements[0]
14
14
  end
15
15
 
16
- def scenario_sequence
16
+ def scenario_sequence #:nodoc:
17
17
  elements[1]
18
18
  end
19
19
 
20
20
  end
21
21
 
22
- module Root1
23
- def compile
22
+ module Root1 #:nodoc:
23
+ def compile #:nodoc:
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 #:nodoc:
31
31
  start_index = index
32
32
  if node_cache[:root].has_key?(index)
33
33
  cached = node_cache[:root][index]
@@ -65,10 +65,10 @@ module Feature
65
65
  return r0
66
66
  end
67
67
 
68
- module Header0
68
+ module Header0 #:nodoc:
69
69
  end
70
70
 
71
- def _nt_header
71
+ def _nt_header #:nodoc:
72
72
  start_index = index
73
73
  if node_cache[:header].has_key?(index)
74
74
  cached = node_cache[:header][index]
@@ -123,39 +123,39 @@ module Feature
123
123
  return r0
124
124
  end
125
125
 
126
- module ScenarioSequence0
127
- def space
126
+ module ScenarioSequence0 #:nodoc:
127
+ def space #:nodoc:
128
128
  elements[0]
129
129
  end
130
130
 
131
- def scenario_or_table
131
+ def scenario_or_table #:nodoc:
132
132
  elements[1]
133
133
  end
134
134
  end
135
135
 
136
- module ScenarioSequence1
137
- def head
136
+ module ScenarioSequence1 #:nodoc:
137
+ def head #:nodoc:
138
138
  elements[0]
139
139
  end
140
140
 
141
- def tail
141
+ def tail #:nodoc:
142
142
  elements[1]
143
143
  end
144
144
  end
145
145
 
146
- module ScenarioSequence2
147
- def compile(feature)
146
+ module ScenarioSequence2 #:nodoc:
147
+ def compile(feature) #:nodoc:
148
148
  ([head] + tail).each do |scenario_or_table|
149
149
  scenario_or_table.compile(feature) if scenario_or_table.respond_to?(:compile)
150
150
  end
151
151
  end
152
152
 
153
- def tail
153
+ def tail #:nodoc:
154
154
  super.elements.map { |elt| elt.scenario_or_table }
155
155
  end
156
156
  end
157
157
 
158
- def _nt_scenario_sequence
158
+ def _nt_scenario_sequence #:nodoc:
159
159
  start_index = index
160
160
  if node_cache[:scenario_sequence].has_key?(index)
161
161
  cached = node_cache[:scenario_sequence][index]
@@ -211,36 +211,36 @@ module Feature
211
211
  return r0
212
212
  end
213
213
 
214
- module Scenario0
215
- def space
214
+ module Scenario0 #:nodoc:
215
+ def space #:nodoc:
216
216
  elements[0]
217
217
  end
218
218
 
219
- def step_sequence
219
+ def step_sequence #:nodoc:
220
220
  elements[1]
221
221
  end
222
222
  end
223
223
 
224
- module Scenario1
225
- def scenario_keyword
224
+ module Scenario1 #:nodoc:
225
+ def scenario_keyword #:nodoc:
226
226
  elements[0]
227
227
  end
228
228
 
229
- def space
229
+ def space #:nodoc:
230
230
  elements[1]
231
231
  end
232
232
 
233
- def name
233
+ def name #:nodoc:
234
234
  elements[2]
235
235
  end
236
236
 
237
- def steps
237
+ def steps #:nodoc:
238
238
  elements[3]
239
239
  end
240
240
  end
241
241
 
242
- module Scenario2
243
- def compile(feature)
242
+ module Scenario2 #:nodoc:
243
+ def compile(feature) #:nodoc:
244
244
  scenario = feature.add_scenario(name.text_value.strip)
245
245
  steps.step_sequence.compile(scenario) if steps.respond_to?(:step_sequence)
246
246
  # TODO - GET RID OF THIS last_scenario NASTINESS
@@ -249,7 +249,7 @@ module Feature
249
249
  end
250
250
  end
251
251
 
252
- def _nt_scenario
252
+ def _nt_scenario #:nodoc:
253
253
  start_index = index
254
254
  if node_cache[:scenario].has_key?(index)
255
255
  cached = node_cache[:scenario][index]
@@ -304,7 +304,7 @@ module Feature
304
304
  return r0
305
305
  end
306
306
 
307
- def _nt_scenario_or_table
307
+ def _nt_scenario_or_table #:nodoc:
308
308
  start_index = index
309
309
  if node_cache[:scenario_or_table].has_key?(index)
310
310
  cached = node_cache[:scenario_or_table][index]
@@ -331,40 +331,40 @@ module Feature
331
331
  return r0
332
332
  end
333
333
 
334
- module Table0
335
- def eol
334
+ module Table0 #:nodoc:
335
+ def eol #:nodoc:
336
336
  elements[1]
337
337
  end
338
338
 
339
- def table_line
339
+ def table_line #:nodoc:
340
340
  elements[3]
341
341
  end
342
342
  end
343
343
 
344
- module Table1
345
- def head
344
+ module Table1 #:nodoc:
345
+ def head #:nodoc:
346
346
  elements[0]
347
347
  end
348
348
 
349
- def body
349
+ def body #:nodoc:
350
350
  elements[1]
351
351
  end
352
352
  end
353
353
 
354
- module Table2
355
- def compile(feature)
354
+ module Table2 #:nodoc:
355
+ def compile(feature) #:nodoc:
356
356
  Feature.last_scenario.table_header = head.cell_values
357
357
  body.each do |table_line|
358
358
  feature.add_row_scenario(Feature.last_scenario, table_line.cell_values, table_line.line)
359
359
  end
360
360
  end
361
361
 
362
- def body
362
+ def body #:nodoc:
363
363
  super.elements.map { |elt| elt.table_line }
364
364
  end
365
365
  end
366
366
 
367
- def _nt_table
367
+ def _nt_table #:nodoc:
368
368
  start_index = index
369
369
  if node_cache[:table].has_key?(index)
370
370
  cached = node_cache[:table][index]
@@ -437,37 +437,37 @@ module Feature
437
437
  return r0
438
438
  end
439
439
 
440
- module TableLine0
441
- def cell_value
440
+ module TableLine0 #:nodoc:
441
+ def cell_value #:nodoc:
442
442
  elements[1]
443
443
  end
444
444
 
445
- def separator
445
+ def separator #:nodoc:
446
446
  elements[3]
447
447
  end
448
448
  end
449
449
 
450
- module TableLine1
451
- def separator
450
+ module TableLine1 #:nodoc:
451
+ def separator #:nodoc:
452
452
  elements[0]
453
453
  end
454
454
 
455
- def cells
455
+ def cells #:nodoc:
456
456
  elements[1]
457
457
  end
458
458
  end
459
459
 
460
- module TableLine2
461
- def cell_values
460
+ module TableLine2 #:nodoc:
461
+ def cell_values #:nodoc:
462
462
  cells.elements.map { |elt| elt.cell_value.text_value.strip }
463
463
  end
464
464
 
465
- def line
465
+ def line #:nodoc:
466
466
  input.line_of(interval.first)
467
467
  end
468
468
  end
469
469
 
470
- def _nt_table_line
470
+ def _nt_table_line #:nodoc:
471
471
  start_index = index
472
472
  if node_cache[:table_line].has_key?(index)
473
473
  cached = node_cache[:table_line][index]
@@ -549,10 +549,10 @@ module Feature
549
549
  return r0
550
550
  end
551
551
 
552
- module CellValue0
552
+ module CellValue0 #:nodoc:
553
553
  end
554
554
 
555
- def _nt_cell_value
555
+ def _nt_cell_value #:nodoc:
556
556
  start_index = index
557
557
  if node_cache[:cell_value].has_key?(index)
558
558
  cached = node_cache[:cell_value][index]
@@ -614,39 +614,39 @@ module Feature
614
614
  return r0
615
615
  end
616
616
 
617
- module StepSequence0
618
- def space
617
+ module StepSequence0 #:nodoc:
618
+ def space #:nodoc:
619
619
  elements[0]
620
620
  end
621
621
 
622
- def step
622
+ def step #:nodoc:
623
623
  elements[1]
624
624
  end
625
625
  end
626
626
 
627
- module StepSequence1
628
- def head
627
+ module StepSequence1 #:nodoc:
628
+ def head #:nodoc:
629
629
  elements[0]
630
630
  end
631
631
 
632
- def tail
632
+ def tail #:nodoc:
633
633
  elements[1]
634
634
  end
635
635
  end
636
636
 
637
- module StepSequence2
638
- def compile(scenario)
637
+ module StepSequence2 #:nodoc:
638
+ def compile(scenario) #:nodoc:
639
639
  ([head] + tail).each do |step|
640
640
  step.compile(scenario)
641
641
  end
642
642
  end
643
643
 
644
- def tail
644
+ def tail #:nodoc:
645
645
  super.elements.map { |elt| elt.step }
646
646
  end
647
647
  end
648
648
 
649
- def _nt_step_sequence
649
+ def _nt_step_sequence #:nodoc:
650
650
  start_index = index
651
651
  if node_cache[:step_sequence].has_key?(index)
652
652
  cached = node_cache[:step_sequence][index]
@@ -697,7 +697,7 @@ module Feature
697
697
  return r0
698
698
  end
699
699
 
700
- def _nt_step
700
+ def _nt_step #:nodoc:
701
701
  start_index = index
702
702
  if node_cache[:step].has_key?(index)
703
703
  cached = node_cache[:step][index]
@@ -724,28 +724,28 @@ module Feature
724
724
  return r0
725
725
  end
726
726
 
727
- module GivenScenario0
728
- def given_scenario_keyword
727
+ module GivenScenario0 #:nodoc:
728
+ def given_scenario_keyword #:nodoc:
729
729
  elements[0]
730
730
  end
731
731
 
732
- def space
732
+ def space #:nodoc:
733
733
  elements[1]
734
734
  end
735
735
 
736
- def name
736
+ def name #:nodoc:
737
737
  elements[2]
738
738
  end
739
739
  end
740
740
 
741
- module GivenScenario1
742
- def compile(scenario)
741
+ module GivenScenario1 #:nodoc:
742
+ def compile(scenario) #:nodoc:
743
743
  line = input.line_of(interval.first)
744
- scenario.add_given_scenario(name.text_value.strip, line)
744
+ scenario.create_given_scenario(name.text_value.strip, line)
745
745
  end
746
746
  end
747
747
 
748
- def _nt_given_scenario
748
+ def _nt_given_scenario #:nodoc:
749
749
  start_index = index
750
750
  if node_cache[:given_scenario].has_key?(index)
751
751
  cached = node_cache[:given_scenario][index]
@@ -778,28 +778,28 @@ module Feature
778
778
  return r0
779
779
  end
780
780
 
781
- module PlainStep0
782
- def step_keyword
781
+ module PlainStep0 #:nodoc:
782
+ def step_keyword #:nodoc:
783
783
  elements[0]
784
784
  end
785
785
 
786
- def space
786
+ def space #:nodoc:
787
787
  elements[1]
788
788
  end
789
789
 
790
- def name
790
+ def name #:nodoc:
791
791
  elements[2]
792
792
  end
793
793
  end
794
794
 
795
- module PlainStep1
796
- def compile(scenario)
795
+ module PlainStep1 #:nodoc:
796
+ def compile(scenario) #:nodoc:
797
797
  line = input.line_of(interval.first)
798
- scenario.add_step(step_keyword.text_value, name.text_value.strip, line)
798
+ scenario.create_step(step_keyword.text_value, name.text_value.strip, line)
799
799
  end
800
800
  end
801
801
 
802
- def _nt_plain_step
802
+ def _nt_plain_step #:nodoc:
803
803
  start_index = index
804
804
  if node_cache[:plain_step].has_key?(index)
805
805
  cached = node_cache[:plain_step][index]
@@ -832,7 +832,7 @@ module Feature
832
832
  return r0
833
833
  end
834
834
 
835
- def _nt_separator
835
+ def _nt_separator #:nodoc:
836
836
  start_index = index
837
837
  if node_cache[:separator].has_key?(index)
838
838
  cached = node_cache[:separator][index]
@@ -853,7 +853,7 @@ module Feature
853
853
  return r0
854
854
  end
855
855
 
856
- def _nt_space
856
+ def _nt_space #:nodoc:
857
857
  start_index = index
858
858
  if node_cache[:space].has_key?(index)
859
859
  cached = node_cache[:space][index]
@@ -894,10 +894,10 @@ module Feature
894
894
  return r0
895
895
  end
896
896
 
897
- module LineToEol0
897
+ module LineToEol0 #:nodoc:
898
898
  end
899
899
 
900
- def _nt_line_to_eol
900
+ def _nt_line_to_eol #:nodoc:
901
901
  start_index = index
902
902
  if node_cache[:line_to_eol].has_key?(index)
903
903
  cached = node_cache[:line_to_eol][index]
@@ -947,13 +947,13 @@ module Feature
947
947
  return r0
948
948
  end
949
949
 
950
- module CommentToEol0
951
- def line_to_eol
950
+ module CommentToEol0 #:nodoc:
951
+ def line_to_eol #:nodoc:
952
952
  elements[1]
953
953
  end
954
954
  end
955
955
 
956
- def _nt_comment_to_eol
956
+ def _nt_comment_to_eol #:nodoc:
957
957
  start_index = index
958
958
  if node_cache[:comment_to_eol].has_key?(index)
959
959
  cached = node_cache[:comment_to_eol][index]
@@ -987,7 +987,7 @@ module Feature
987
987
  return r0
988
988
  end
989
989
 
990
- def _nt_white
990
+ def _nt_white #:nodoc:
991
991
  start_index = index
992
992
  if node_cache[:white].has_key?(index)
993
993
  cached = node_cache[:white][index]
@@ -1014,7 +1014,7 @@ module Feature
1014
1014
  return r0
1015
1015
  end
1016
1016
 
1017
- def _nt_blank
1017
+ def _nt_blank #:nodoc:
1018
1018
  start_index = index
1019
1019
  if node_cache[:blank].has_key?(index)
1020
1020
  cached = node_cache[:blank][index]
@@ -1034,7 +1034,10 @@ module Feature
1034
1034
  return r0
1035
1035
  end
1036
1036
 
1037
- def _nt_eol
1037
+ module Eol0 #:nodoc:
1038
+ end
1039
+
1040
+ def _nt_eol #:nodoc:
1038
1041
  start_index = index
1039
1042
  if node_cache[:eol].has_key?(index)
1040
1043
  cached = node_cache[:eol][index]
@@ -1043,25 +1046,49 @@ module Feature
1043
1046
  end
1044
1047
 
1045
1048
  i0 = index
1046
- if input.index("\r\n?", index) == index
1047
- r1 = (SyntaxNode).new(input, index...(index + 3))
1048
- @index += 3
1049
+ i1, s1 = index, []
1050
+ if input.index("\r", index) == index
1051
+ r2 = (SyntaxNode).new(input, index...(index + 1))
1052
+ @index += 1
1049
1053
  else
1050
- terminal_parse_failure("\r\n?")
1054
+ terminal_parse_failure("\r")
1055
+ r2 = nil
1056
+ end
1057
+ s1 << r2
1058
+ if r2
1059
+ if input.index("\n", index) == index
1060
+ r4 = (SyntaxNode).new(input, index...(index + 1))
1061
+ @index += 1
1062
+ else
1063
+ terminal_parse_failure("\n")
1064
+ r4 = nil
1065
+ end
1066
+ if r4
1067
+ r3 = r4
1068
+ else
1069
+ r3 = SyntaxNode.new(input, index...index)
1070
+ end
1071
+ s1 << r3
1072
+ end
1073
+ if s1.last
1074
+ r1 = (SyntaxNode).new(input, i1...index, s1)
1075
+ r1.extend(Eol0)
1076
+ else
1077
+ self.index = i1
1051
1078
  r1 = nil
1052
1079
  end
1053
1080
  if r1
1054
1081
  r0 = r1
1055
1082
  else
1056
1083
  if input.index("\n", index) == index
1057
- r2 = (SyntaxNode).new(input, index...(index + 1))
1084
+ r5 = (SyntaxNode).new(input, index...(index + 1))
1058
1085
  @index += 1
1059
1086
  else
1060
1087
  terminal_parse_failure("\n")
1061
- r2 = nil
1088
+ r5 = nil
1062
1089
  end
1063
- if r2
1064
- r0 = r2
1090
+ if r5
1091
+ r0 = r5
1065
1092
  else
1066
1093
  self.index = i0
1067
1094
  r0 = nil
@@ -1073,7 +1100,7 @@ module Feature
1073
1100
  return r0
1074
1101
  end
1075
1102
 
1076
- def _nt_step_keyword
1103
+ def _nt_step_keyword #:nodoc:
1077
1104
  start_index = index
1078
1105
  if node_cache[:step_keyword].has_key?(index)
1079
1106
  cached = node_cache[:step_keyword][index]
@@ -1122,8 +1149,19 @@ module Feature
1122
1149
  if r4
1123
1150
  r0 = r4
1124
1151
  else
1125
- self.index = i0
1126
- r0 = nil
1152
+ if input.index('Pero', index) == index
1153
+ r5 = (SyntaxNode).new(input, index...(index + 4))
1154
+ @index += 4
1155
+ else
1156
+ terminal_parse_failure('Pero')
1157
+ r5 = nil
1158
+ end
1159
+ if r5
1160
+ r0 = r5
1161
+ else
1162
+ self.index = i0
1163
+ r0 = nil
1164
+ end
1127
1165
  end
1128
1166
  end
1129
1167
  end
@@ -1134,7 +1172,7 @@ module Feature
1134
1172
  return r0
1135
1173
  end
1136
1174
 
1137
- def _nt_scenario_keyword
1175
+ def _nt_scenario_keyword #:nodoc:
1138
1176
  start_index = index
1139
1177
  if node_cache[:scenario_keyword].has_key?(index)
1140
1178
  cached = node_cache[:scenario_keyword][index]
@@ -1155,10 +1193,10 @@ module Feature
1155
1193
  return r0
1156
1194
  end
1157
1195
 
1158
- module GivenScenarioKeyword0
1196
+ module GivenScenarioKeyword0 #:nodoc:
1159
1197
  end
1160
1198
 
1161
- def _nt_given_scenario_keyword
1199
+ def _nt_given_scenario_keyword #:nodoc:
1162
1200
  start_index = index
1163
1201
  if node_cache[:given_scenario_keyword].has_key?(index)
1164
1202
  cached = node_cache[:given_scenario_keyword][index]
@@ -1205,7 +1243,7 @@ module Feature
1205
1243
 
1206
1244
  end
1207
1245
 
1208
- class FeatureParser < Treetop::Runtime::CompiledParser
1246
+ class FeatureParser < Treetop::Runtime::CompiledParser #:nodoc:
1209
1247
  include Feature
1210
1248
  end
1211
1249