cucumber 0.6.4 → 0.7.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. data/History.txt +11 -0
  2. data/Rakefile +3 -5
  3. data/VERSION.yml +3 -3
  4. data/cucumber.gemspec +35 -55
  5. data/cucumber.yml +3 -2
  6. data/examples/i18n/Rakefile +1 -0
  7. data/examples/i18n/en-lol/features/step_definitions/cucumbrz_steps.rb +1 -1
  8. data/examples/i18n/eo/.gitignore +1 -0
  9. data/examples/i18n/eo/Rakefile +6 -0
  10. data/examples/i18n/eo/features/adicio.feature +17 -0
  11. data/examples/i18n/eo/features/divido.feature +10 -0
  12. data/examples/i18n/eo/features/step_definitons/calculator_steps.rb +24 -0
  13. data/examples/i18n/eo/lib/calculator.rb +14 -0
  14. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +1 -1
  15. data/examples/i18n/ru/features/division.feature +1 -1
  16. data/examples/i18n/uk/Rakefile +6 -0
  17. data/examples/i18n/uk/features/addition.feature +11 -0
  18. data/examples/i18n/uk/features/consecutive_calculations.feature +17 -0
  19. data/examples/i18n/uk/features/division.feature +16 -0
  20. data/examples/i18n/uk/features/step_definitons/calculator_steps.rb +19 -0
  21. data/examples/i18n/uk/features/support/env.rb +5 -0
  22. data/examples/i18n/uk/features/support/world.rb +8 -0
  23. data/examples/i18n/uk/lib/calculator.rb +24 -0
  24. data/examples/i18n/uz/features/step_definitons/calculator_steps.rb +1 -1
  25. data/examples/sinatra/features/add.feature +1 -1
  26. data/examples/sinatra/features/step_definitions/add_steps.rb +1 -1
  27. data/examples/sinatra/features/support/env.rb +2 -19
  28. data/examples/sinatra/views/add.erb +7 -5
  29. data/features/announce.feature +46 -39
  30. data/features/background.feature +3 -0
  31. data/features/call_many_steps.feature +1 -1
  32. data/features/cucumber_cli_outlines.feature +12 -0
  33. data/features/drb_server_integration.feature +1 -1
  34. data/features/exception_in_after_block.feature +3 -0
  35. data/features/exception_in_after_step_block.feature +3 -0
  36. data/features/html_formatter/a.html +29 -29
  37. data/features/language_help.feature +57 -52
  38. data/features/multiline_names.feature +1 -0
  39. data/features/step_definitions/cucumber_steps.rb +2 -1
  40. data/features/usage_and_stepdefs_formatter.feature +30 -30
  41. data/features/wire_protocol.feature +12 -9
  42. data/features/wire_protocol_table_diffing.feature +8 -6
  43. data/features/wire_protocol_timeouts.feature +5 -4
  44. data/gem_tasks/treetop.rake +13 -0
  45. data/lib/autotest/cucumber_mixin.rb +1 -1
  46. data/lib/cucumber/ast.rb +1 -0
  47. data/lib/cucumber/ast/background.rb +14 -4
  48. data/lib/cucumber/ast/examples.rb +2 -0
  49. data/lib/cucumber/ast/feature.rb +26 -5
  50. data/lib/cucumber/ast/feature_element.rb +18 -9
  51. data/lib/cucumber/ast/outline_table.rb +13 -1
  52. data/lib/cucumber/ast/py_string.rb +26 -9
  53. data/lib/cucumber/ast/scenario.rb +13 -7
  54. data/lib/cucumber/ast/scenario_outline.rb +18 -6
  55. data/lib/cucumber/ast/step.rb +4 -4
  56. data/lib/cucumber/ast/step_invocation.rb +5 -2
  57. data/lib/cucumber/ast/table.rb +26 -1
  58. data/lib/cucumber/ast/tags.rb +3 -1
  59. data/lib/cucumber/ast/tree_walker.rb +2 -18
  60. data/lib/cucumber/cli/configuration.rb +2 -2
  61. data/lib/cucumber/cli/options.rb +16 -21
  62. data/lib/cucumber/feature_file.rb +25 -7
  63. data/lib/cucumber/formatter/ansicolor.rb +6 -1
  64. data/lib/cucumber/formatter/console.rb +4 -3
  65. data/lib/cucumber/formatter/html.rb +8 -5
  66. data/lib/cucumber/formatter/junit.rb +5 -4
  67. data/lib/cucumber/formatter/pdf.rb +2 -3
  68. data/lib/cucumber/formatter/pretty.rb +5 -5
  69. data/lib/cucumber/formatter/usage.rb +2 -2
  70. data/lib/cucumber/parser.rb +0 -6
  71. data/lib/cucumber/parser/gherkin_builder.rb +142 -0
  72. data/lib/cucumber/platform.rb +0 -2
  73. data/lib/cucumber/rb_support/rb_language.rb +7 -12
  74. data/lib/cucumber/step_mother.rb +4 -26
  75. data/spec/cucumber/ast/background_spec.rb +0 -1
  76. data/spec/cucumber/ast/feature_factory.rb +2 -4
  77. data/spec/cucumber/ast/feature_spec.rb +0 -2
  78. data/spec/cucumber/ast/py_string_spec.rb +2 -13
  79. data/spec/cucumber/ast/scenario_outline_spec.rb +0 -1
  80. data/spec/cucumber/ast/scenario_spec.rb +0 -1
  81. data/spec/cucumber/ast/step_spec.rb +1 -1
  82. data/spec/cucumber/ast/table_spec.rb +2 -2
  83. data/spec/cucumber/cli/main_spec.rb +1 -1
  84. data/spec/cucumber/cli/options_spec.rb +2 -2
  85. data/spec/cucumber/formatter/html_spec.rb +20 -1
  86. data/spec/cucumber/formatter/junit_spec.rb +1 -0
  87. data/spec/cucumber/formatter/spec_helper.rb +7 -5
  88. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +0 -1
  89. data/spec/cucumber/step_mother_spec.rb +2 -2
  90. data/spec/spec_helper.rb +0 -1
  91. metadata +67 -93
  92. data/lib/cucumber/cli/language_help_formatter.rb +0 -72
  93. data/lib/cucumber/filter.rb +0 -43
  94. data/lib/cucumber/languages.yml +0 -536
  95. data/lib/cucumber/parser/common.rb +0 -182
  96. data/lib/cucumber/parser/common.tt +0 -21
  97. data/lib/cucumber/parser/feature.rb +0 -1591
  98. data/lib/cucumber/parser/feature.tt +0 -287
  99. data/lib/cucumber/parser/i18n.tt +0 -35
  100. data/lib/cucumber/parser/natural_language.rb +0 -118
  101. data/lib/cucumber/parser/py_string.rb +0 -285
  102. data/lib/cucumber/parser/py_string.tt +0 -45
  103. data/lib/cucumber/parser/table.rb +0 -314
  104. data/lib/cucumber/parser/table.tt +0 -60
  105. data/lib/cucumber/parser/treetop_ext.rb +0 -54
  106. data/lib/cucumber/tag_expression.rb +0 -41
  107. data/spec/cucumber/ast/feature_element_spec.rb +0 -41
  108. data/spec/cucumber/ast/step_collection_spec.rb +0 -17
  109. data/spec/cucumber/parser/feature_parser_spec.rb +0 -400
  110. data/spec/cucumber/parser/table_parser_spec.rb +0 -52
  111. data/spec/cucumber/tag_expression_spec.rb +0 -125
  112. data/spec/cucumber/treetop_parser/empty_feature.feature +0 -4
  113. data/spec/cucumber/treetop_parser/empty_scenario.feature +0 -9
  114. data/spec/cucumber/treetop_parser/empty_scenario_outline.feature +0 -3
  115. data/spec/cucumber/treetop_parser/fit_scenario.feature +0 -8
  116. data/spec/cucumber/treetop_parser/given_scenario.feature +0 -9
  117. data/spec/cucumber/treetop_parser/invalid_scenario_outlines.feature +0 -7
  118. data/spec/cucumber/treetop_parser/multiline_steps.feature +0 -17
  119. data/spec/cucumber/treetop_parser/multiple_tables.feature +0 -27
  120. data/spec/cucumber/treetop_parser/scenario_outline.feature +0 -16
  121. data/spec/cucumber/treetop_parser/spaces.feature +0 -12
  122. data/spec/cucumber/treetop_parser/test_dos.feature +0 -25
  123. data/spec/cucumber/treetop_parser/with_comments.feature +0 -23
  124. data/spec/cucumber/treetop_parser/with_tags.feature +0 -18
@@ -1,45 +0,0 @@
1
- module Cucumber
2
- module Parser
3
- # TIP: When you hack on the grammar, just delete py_string.rb in this directory.
4
- # Also make sure you have uninstalled all cucumber gems (don't forget xxx-cucumber
5
- # github gems).
6
- #
7
- # Treetop will then generate the parser in-memory. When you're happy, just generate
8
- # the rb file with tt feature.tt
9
- grammar PyString
10
- include Common
11
-
12
- rule py_string
13
- open_py_string s:(!close_py_string .)* close_py_string {
14
- def at_line?(line)
15
- line >= open_py_string.line && line <= close_py_string.line
16
- end
17
-
18
- def build(ignored_filter=nil)
19
- Ast::PyString.new(open_py_string.line, close_py_string.line, s.text_value, open_py_string.indentation)
20
- end
21
- }
22
- end
23
-
24
- rule open_py_string
25
- indent:space* '"""' space* eol {
26
- def indentation
27
- indent.text_value
28
- end
29
-
30
- def line
31
- indent.line
32
- end
33
- }
34
- end
35
-
36
- rule close_py_string
37
- eol space* quotes:'"""' white {
38
- def line
39
- quotes.line
40
- end
41
- }
42
- end
43
- end
44
- end
45
- end
@@ -1,314 +0,0 @@
1
- # Autogenerated from a Treetop grammar. Edits may be lost.
2
-
3
-
4
- module Cucumber
5
- module Parser
6
- # TIP: When you hack on the grammar, just delete table.rb in this directory.
7
- # Also make sure you have uninstalled all cucumber gems (don't forget xxx-cucumber
8
- # github gems).
9
- #
10
- # Treetop will then generate the parser in-memory. When you're happy, just generate
11
- # the rb file with tt feature.tt
12
- module Table
13
- include Treetop::Runtime
14
-
15
- def root
16
- @root || :table
17
- end
18
-
19
- include Common
20
-
21
- module Table0
22
- def at_line?(line)
23
- elements.detect{|table_row| table_row.at_line?(line)}
24
- end
25
-
26
- def build(filter=nil)
27
- Ast::Table.new(raw)
28
- end
29
-
30
- def raw(filter=nil, scenario_outline=nil)
31
- elements.map do |table_row|
32
- if(filter.nil? || table_row == elements[0] || filter.at_line?(table_row) || (scenario_outline && filter.outline_at_line?(scenario_outline)))
33
- table_row.build
34
- end
35
- end.compact
36
- end
37
- end
38
-
39
- def _nt_table
40
- start_index = index
41
- if node_cache[:table].has_key?(index)
42
- cached = node_cache[:table][index]
43
- if cached
44
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
45
- @index = cached.interval.end
46
- end
47
- return cached
48
- end
49
-
50
- s0, i0 = [], index
51
- loop do
52
- r1 = _nt_table_row
53
- if r1
54
- s0 << r1
55
- else
56
- break
57
- end
58
- end
59
- if s0.empty?
60
- @index = i0
61
- r0 = nil
62
- else
63
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
64
- r0.extend(Table0)
65
- end
66
-
67
- node_cache[:table][start_index] = r0
68
-
69
- r0
70
- end
71
-
72
- module TableRow0
73
- def cell
74
- elements[0]
75
- end
76
-
77
- end
78
-
79
- module TableRow1
80
- def cells
81
- elements[2]
82
- end
83
-
84
- end
85
-
86
- module TableRow2
87
- def at_line?(line)
88
- cells.line == line
89
- end
90
-
91
- def build
92
- row = cells.elements.map do |elt|
93
- value = elt.cell.text_value.strip
94
- value
95
- end
96
-
97
- class << row
98
- attr_accessor :line
99
- end
100
- row.line = cells.line
101
-
102
- row
103
- end
104
- end
105
-
106
- def _nt_table_row
107
- start_index = index
108
- if node_cache[:table_row].has_key?(index)
109
- cached = node_cache[:table_row][index]
110
- if cached
111
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
112
- @index = cached.interval.end
113
- end
114
- return cached
115
- end
116
-
117
- i0, s0 = index, []
118
- s1, i1 = [], index
119
- loop do
120
- r2 = _nt_space
121
- if r2
122
- s1 << r2
123
- else
124
- break
125
- end
126
- end
127
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
128
- s0 << r1
129
- if r1
130
- if has_terminal?('|', false, index)
131
- r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
132
- @index += 1
133
- else
134
- terminal_parse_failure('|')
135
- r3 = nil
136
- end
137
- s0 << r3
138
- if r3
139
- s4, i4 = [], index
140
- loop do
141
- i5, s5 = index, []
142
- r6 = _nt_cell
143
- s5 << r6
144
- if r6
145
- if has_terminal?('|', false, index)
146
- r7 = instantiate_node(SyntaxNode,input, index...(index + 1))
147
- @index += 1
148
- else
149
- terminal_parse_failure('|')
150
- r7 = nil
151
- end
152
- s5 << r7
153
- end
154
- if s5.last
155
- r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
156
- r5.extend(TableRow0)
157
- else
158
- @index = i5
159
- r5 = nil
160
- end
161
- if r5
162
- s4 << r5
163
- else
164
- break
165
- end
166
- end
167
- if s4.empty?
168
- @index = i4
169
- r4 = nil
170
- else
171
- r4 = instantiate_node(SyntaxNode,input, i4...index, s4)
172
- end
173
- s0 << r4
174
- if r4
175
- s8, i8 = [], index
176
- loop do
177
- r9 = _nt_space
178
- if r9
179
- s8 << r9
180
- else
181
- break
182
- end
183
- end
184
- r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
185
- s0 << r8
186
- if r8
187
- i10 = index
188
- s11, i11 = [], index
189
- loop do
190
- r12 = _nt_eol
191
- if r12
192
- s11 << r12
193
- else
194
- break
195
- end
196
- end
197
- if s11.empty?
198
- @index = i11
199
- r11 = nil
200
- else
201
- r11 = instantiate_node(SyntaxNode,input, i11...index, s11)
202
- end
203
- if r11
204
- r10 = r11
205
- else
206
- r13 = _nt_eof
207
- if r13
208
- r10 = r13
209
- else
210
- @index = i10
211
- r10 = nil
212
- end
213
- end
214
- s0 << r10
215
- end
216
- end
217
- end
218
- end
219
- if s0.last
220
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
221
- r0.extend(TableRow1)
222
- r0.extend(TableRow2)
223
- else
224
- @index = i0
225
- r0 = nil
226
- end
227
-
228
- node_cache[:table_row][start_index] = r0
229
-
230
- r0
231
- end
232
-
233
- module Cell0
234
- end
235
-
236
- def _nt_cell
237
- start_index = index
238
- if node_cache[:cell].has_key?(index)
239
- cached = node_cache[:cell][index]
240
- if cached
241
- cached = SyntaxNode.new(input, index...(index + 1)) if cached == true
242
- @index = cached.interval.end
243
- end
244
- return cached
245
- end
246
-
247
- s0, i0 = [], index
248
- loop do
249
- i1, s1 = index, []
250
- i2 = index
251
- i3 = index
252
- if has_terminal?('|', false, index)
253
- r4 = instantiate_node(SyntaxNode,input, index...(index + 1))
254
- @index += 1
255
- else
256
- terminal_parse_failure('|')
257
- r4 = nil
258
- end
259
- if r4
260
- r3 = r4
261
- else
262
- r5 = _nt_eol
263
- if r5
264
- r3 = r5
265
- else
266
- @index = i3
267
- r3 = nil
268
- end
269
- end
270
- if r3
271
- r2 = nil
272
- else
273
- @index = i2
274
- r2 = instantiate_node(SyntaxNode,input, index...index)
275
- end
276
- s1 << r2
277
- if r2
278
- if index < input_length
279
- r6 = instantiate_node(SyntaxNode,input, index...(index + 1))
280
- @index += 1
281
- else
282
- terminal_parse_failure("any character")
283
- r6 = nil
284
- end
285
- s1 << r6
286
- end
287
- if s1.last
288
- r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
289
- r1.extend(Cell0)
290
- else
291
- @index = i1
292
- r1 = nil
293
- end
294
- if r1
295
- s0 << r1
296
- else
297
- break
298
- end
299
- end
300
- r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
301
-
302
- node_cache[:cell][start_index] = r0
303
-
304
- r0
305
- end
306
-
307
- end
308
-
309
- class TableParser < Treetop::Runtime::CompiledParser
310
- include Table
311
- end
312
-
313
- end
314
- end
@@ -1,60 +0,0 @@
1
- module Cucumber
2
- module Parser
3
- # TIP: When you hack on the grammar, just delete table.rb in this directory.
4
- # Also make sure you have uninstalled all cucumber gems (don't forget xxx-cucumber
5
- # github gems).
6
- #
7
- # Treetop will then generate the parser in-memory. When you're happy, just generate
8
- # the rb file with tt feature.tt
9
- grammar Table
10
- include Common
11
-
12
- rule table
13
- table_row+ {
14
- def at_line?(line)
15
- elements.detect{|table_row| table_row.at_line?(line)}
16
- end
17
-
18
- def build(filter=nil)
19
- Ast::Table.new(raw)
20
- end
21
-
22
- def raw(filter=nil, scenario_outline=nil)
23
- elements.map do |table_row|
24
- if(filter.nil? || table_row == elements[0] || filter.at_line?(table_row) || (scenario_outline && filter.outline_at_line?(scenario_outline)))
25
- table_row.build
26
- end
27
- end.compact
28
- end
29
- }
30
- end
31
-
32
- rule table_row
33
- space* '|' cells:(cell '|')+ space* (eol+ / eof) {
34
- def at_line?(line)
35
- cells.line == line
36
- end
37
-
38
- def build
39
- row = cells.elements.map do |elt|
40
- value = elt.cell.text_value.strip
41
- value
42
- end
43
-
44
- class << row
45
- attr_accessor :line
46
- end
47
- row.line = cells.line
48
-
49
- row
50
- end
51
- }
52
- end
53
-
54
- rule cell
55
- (!('|' / eol) .)*
56
- end
57
-
58
- end
59
- end
60
- end
@@ -1,54 +0,0 @@
1
- begin
2
- require 'treetop'
3
- require 'treetop/runtime'
4
- require 'treetop/ruby_extensions'
5
- rescue LoadError
6
- require "rubygems"
7
- gem "treetop"
8
- require 'treetop'
9
- require 'treetop/runtime'
10
- require 'treetop/ruby_extensions'
11
- end
12
-
13
- module Cucumber
14
- module Parser
15
- # Raised if Cucumber fails to parse a feature file
16
- class SyntaxError < StandardError
17
- def initialize(parser, file, line_offset)
18
- tf = parser.terminal_failures
19
- expected = tf.size == 1 ? tf[0].expected_string.inspect : "one of #{tf.map{|f| f.expected_string.inspect}.uniq*', '}"
20
- line = parser.failure_line + line_offset
21
- message = "#{file}:#{line}:#{parser.failure_column}: Parse error, expected #{expected}."
22
- super(message)
23
- end
24
- end
25
-
26
- module TreetopExt #:nodoc:
27
- def parse_or_fail(source, file=nil, filter=nil, line_offset=0)
28
- parse_tree = parse(source)
29
- if parse_tree.nil?
30
- raise Cucumber::Parser::SyntaxError.new(self, file, line_offset)
31
- else
32
- ast = parse_tree.build(filter) # may return nil if it doesn't match filter.
33
- ast.file = file unless ast.nil?
34
- ast
35
- end
36
- end
37
- end
38
- end
39
- end
40
-
41
- module Treetop #:nodoc:
42
- module Runtime #:nodoc:
43
- class SyntaxNode #:nodoc:
44
- def line
45
- input.line_of(interval.first)
46
- end
47
- end
48
-
49
- class CompiledParser #:nodoc:
50
- public :prepare_to_parse
51
- include Cucumber::Parser::TreetopExt
52
- end
53
- end
54
- end