gherkin 2.2.5-x86-mswin32

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.
Files changed (132) hide show
  1. data/.gitattributes +2 -0
  2. data/.gitignore +11 -0
  3. data/.mailmap +2 -0
  4. data/.rspec +1 -0
  5. data/.rvmrc +1 -0
  6. data/Gemfile +5 -0
  7. data/History.txt +306 -0
  8. data/LICENSE +20 -0
  9. data/README.rdoc +59 -0
  10. data/Rakefile +16 -0
  11. data/VERSION +1 -0
  12. data/bin/gherkin +5 -0
  13. data/build_native_gems.sh +8 -0
  14. data/cucumber.yml +3 -0
  15. data/features/escaped_pipes.feature +8 -0
  16. data/features/feature_parser.feature +237 -0
  17. data/features/json_formatter.feature +278 -0
  18. data/features/json_parser.feature +318 -0
  19. data/features/native_lexer.feature +19 -0
  20. data/features/parser_with_native_lexer.feature +205 -0
  21. data/features/pretty_formatter.feature +15 -0
  22. data/features/step_definitions/eyeball_steps.rb +3 -0
  23. data/features/step_definitions/gherkin_steps.rb +29 -0
  24. data/features/step_definitions/json_formatter_steps.rb +28 -0
  25. data/features/step_definitions/json_parser_steps.rb +20 -0
  26. data/features/step_definitions/pretty_formatter_steps.rb +82 -0
  27. data/features/steps_parser.feature +46 -0
  28. data/features/support/env.rb +38 -0
  29. data/gherkin.gemspec +59 -0
  30. data/ikvm/.gitignore +3 -0
  31. data/java/.gitignore +2 -0
  32. data/java/src/main/java/gherkin/lexer/i18n/.gitignore +1 -0
  33. data/java/src/main/resources/gherkin/.gitignore +1 -0
  34. data/lib/.gitignore +4 -0
  35. data/lib/gherkin.rb +2 -0
  36. data/lib/gherkin/c_lexer.rb +17 -0
  37. data/lib/gherkin/cli/main.rb +33 -0
  38. data/lib/gherkin/formatter/argument.rb +28 -0
  39. data/lib/gherkin/formatter/colors.rb +119 -0
  40. data/lib/gherkin/formatter/escaping.rb +15 -0
  41. data/lib/gherkin/formatter/filter_formatter.rb +136 -0
  42. data/lib/gherkin/formatter/json_formatter.rb +72 -0
  43. data/lib/gherkin/formatter/line_filter.rb +26 -0
  44. data/lib/gherkin/formatter/model.rb +231 -0
  45. data/lib/gherkin/formatter/monochrome_format.rb +9 -0
  46. data/lib/gherkin/formatter/pretty_formatter.rb +174 -0
  47. data/lib/gherkin/formatter/regexp_filter.rb +21 -0
  48. data/lib/gherkin/formatter/tag_count_formatter.rb +47 -0
  49. data/lib/gherkin/formatter/tag_filter.rb +19 -0
  50. data/lib/gherkin/i18n.rb +180 -0
  51. data/lib/gherkin/i18n.yml +601 -0
  52. data/lib/gherkin/json_parser.rb +88 -0
  53. data/lib/gherkin/lexer/i18n_lexer.rb +47 -0
  54. data/lib/gherkin/listener/event.rb +45 -0
  55. data/lib/gherkin/listener/formatter_listener.rb +113 -0
  56. data/lib/gherkin/native.rb +7 -0
  57. data/lib/gherkin/native/ikvm.rb +55 -0
  58. data/lib/gherkin/native/java.rb +55 -0
  59. data/lib/gherkin/native/null.rb +9 -0
  60. data/lib/gherkin/parser/meta.txt +5 -0
  61. data/lib/gherkin/parser/parser.rb +164 -0
  62. data/lib/gherkin/parser/root.txt +11 -0
  63. data/lib/gherkin/parser/steps.txt +4 -0
  64. data/lib/gherkin/rb_lexer.rb +8 -0
  65. data/lib/gherkin/rb_lexer/.gitignore +1 -0
  66. data/lib/gherkin/rb_lexer/README.rdoc +8 -0
  67. data/lib/gherkin/rubify.rb +24 -0
  68. data/lib/gherkin/tag_expression.rb +62 -0
  69. data/lib/gherkin/tools.rb +8 -0
  70. data/lib/gherkin/tools/files.rb +34 -0
  71. data/lib/gherkin/tools/reformat.rb +20 -0
  72. data/lib/gherkin/tools/stats.rb +20 -0
  73. data/lib/gherkin/tools/stats_listener.rb +60 -0
  74. data/lib/gherkin/version.rb +3 -0
  75. data/ragel/i18n/.gitignore +1 -0
  76. data/ragel/lexer.c.rl.erb +459 -0
  77. data/ragel/lexer.java.rl.erb +224 -0
  78. data/ragel/lexer.rb.rl.erb +179 -0
  79. data/ragel/lexer_common.rl.erb +50 -0
  80. data/spec/gherkin/c_lexer_spec.rb +21 -0
  81. data/spec/gherkin/fixtures/1.feature +8 -0
  82. data/spec/gherkin/fixtures/comments_in_table.feature +9 -0
  83. data/spec/gherkin/fixtures/complex.feature +45 -0
  84. data/spec/gherkin/fixtures/complex.json +143 -0
  85. data/spec/gherkin/fixtures/complex_for_filtering.feature +60 -0
  86. data/spec/gherkin/fixtures/complex_with_tags.feature +61 -0
  87. data/spec/gherkin/fixtures/dos_line_endings.feature +45 -0
  88. data/spec/gherkin/fixtures/hantu_pisang.feature +35 -0
  89. data/spec/gherkin/fixtures/i18n_fr.feature +14 -0
  90. data/spec/gherkin/fixtures/i18n_no.feature +7 -0
  91. data/spec/gherkin/fixtures/i18n_zh-CN.feature +9 -0
  92. data/spec/gherkin/fixtures/scenario_outline_with_tags.feature +13 -0
  93. data/spec/gherkin/fixtures/scenario_without_steps.feature +5 -0
  94. data/spec/gherkin/fixtures/simple_with_comments.feature +7 -0
  95. data/spec/gherkin/fixtures/simple_with_tags.feature +11 -0
  96. data/spec/gherkin/fixtures/with_bom.feature +3 -0
  97. data/spec/gherkin/formatter/argument_spec.rb +28 -0
  98. data/spec/gherkin/formatter/colors_spec.rb +18 -0
  99. data/spec/gherkin/formatter/filter_formatter_spec.rb +165 -0
  100. data/spec/gherkin/formatter/model_spec.rb +15 -0
  101. data/spec/gherkin/formatter/pretty_formatter_spec.rb +140 -0
  102. data/spec/gherkin/formatter/spaces.feature +9 -0
  103. data/spec/gherkin/formatter/tabs.feature +9 -0
  104. data/spec/gherkin/formatter/tag_count_formatter_spec.rb +30 -0
  105. data/spec/gherkin/i18n_spec.rb +149 -0
  106. data/spec/gherkin/java_lexer_spec.rb +20 -0
  107. data/spec/gherkin/json.rb +5 -0
  108. data/spec/gherkin/json_parser_spec.rb +67 -0
  109. data/spec/gherkin/lexer/i18n_lexer_spec.rb +43 -0
  110. data/spec/gherkin/output_stream_string_io.rb +24 -0
  111. data/spec/gherkin/parser/parser_spec.rb +16 -0
  112. data/spec/gherkin/rb_lexer_spec.rb +19 -0
  113. data/spec/gherkin/sexp_recorder.rb +56 -0
  114. data/spec/gherkin/shared/lexer_group.rb +592 -0
  115. data/spec/gherkin/shared/py_string_group.rb +153 -0
  116. data/spec/gherkin/shared/row_group.rb +120 -0
  117. data/spec/gherkin/shared/tags_group.rb +54 -0
  118. data/spec/gherkin/tag_expression_spec.rb +137 -0
  119. data/spec/spec_helper.rb +68 -0
  120. data/tasks/bench.rake +184 -0
  121. data/tasks/bench/feature_builder.rb +49 -0
  122. data/tasks/bench/generated/.gitignore +1 -0
  123. data/tasks/bench/null_listener.rb +4 -0
  124. data/tasks/compile.rake +102 -0
  125. data/tasks/cucumber.rake +18 -0
  126. data/tasks/gems.rake +42 -0
  127. data/tasks/ikvm.rake +54 -0
  128. data/tasks/ragel_task.rb +70 -0
  129. data/tasks/rdoc.rake +9 -0
  130. data/tasks/release.rake +30 -0
  131. data/tasks/rspec.rake +8 -0
  132. metadata +447 -0
@@ -0,0 +1,318 @@
1
+ Feature: JSON lexer
2
+ In order to support greater access to features
3
+ we want JSON
4
+
5
+ Background:
6
+ Given a PrettyFormatter
7
+ And a JSON lexer
8
+
9
+ Scenario: Only a Feature
10
+ Given the following JSON is parsed:
11
+ """
12
+ {
13
+ "comments": [
14
+ {"value": "# language: no"},
15
+ {"value": "# Another comment"}
16
+ ],
17
+ "description": "",
18
+ "keyword": "Egenskap",
19
+ "name": "Kjapp",
20
+ "tags": [],
21
+ "uri": "test.feature"
22
+ }
23
+ """
24
+ Then the outputted text should be:
25
+ """
26
+ # language: no
27
+ # Another comment
28
+ Egenskap: Kjapp
29
+ """
30
+
31
+ Scenario: Feature with scenarios and outlines
32
+ Given the following JSON is parsed:
33
+ """
34
+ {
35
+ "comments": [],
36
+ "keyword": "Feature",
37
+ "name": "OH HAI",
38
+ "tags": [{"name": "@one"}],
39
+ "uri": "test.feature",
40
+ "description": "",
41
+ "elements":[
42
+ {
43
+ "comments": [],
44
+ "tags": [],
45
+ "keyword": "Scenario",
46
+ "name": "Fujin",
47
+ "description": "",
48
+ "type": "scenario",
49
+ "line": 4,
50
+ "steps": [
51
+ {
52
+ "comments": [],
53
+ "keyword": "Given ",
54
+ "name": "wind",
55
+ "line": 5
56
+ },
57
+ {
58
+ "comments": [],
59
+ "keyword": "Then ",
60
+ "name": "spirit",
61
+ "line": 6
62
+ }
63
+ ]
64
+ },
65
+ {
66
+ "comments": [],
67
+ "tags": [{"name": "@two"}],
68
+ "keyword": "Scenario",
69
+ "name": "_why",
70
+ "description": "",
71
+ "type": "scenario",
72
+ "line": 9,
73
+ "steps": [
74
+ {
75
+ "comments": [],
76
+ "keyword": "Given ",
77
+ "name": "chunky",
78
+ "line": 10
79
+ },
80
+ {
81
+ "comments": [],
82
+ "keyword": "Then ",
83
+ "name": "bacon",
84
+ "line": 11
85
+ }
86
+ ]
87
+ },
88
+ {
89
+ "comments": [],
90
+ "tags": [{"name": "@three"}, {"name": "@four"}],
91
+ "keyword": "Scenario Outline",
92
+ "name": "Life",
93
+ "description": "",
94
+ "type": "scenario_outline",
95
+ "line": 14,
96
+ "steps": [
97
+ {
98
+ "comments": [],
99
+ "keyword": "Given ",
100
+ "name": "some <boredom>",
101
+ "line": 15
102
+ }
103
+ ],
104
+ "examples": [
105
+ {
106
+ "type": "examples",
107
+ "comments": [],
108
+ "tags": [{"name": "@five"}],
109
+ "keyword": "Examples",
110
+ "name": "Real life",
111
+ "description": "",
112
+ "line": 18,
113
+ "rows": [
114
+ {
115
+ "comments": [],
116
+ "cells": ["boredom"],
117
+ "line": 19
118
+ },
119
+ {
120
+ "comments": [],
121
+ "cells": ["airport"],
122
+ "line": 20
123
+ },
124
+ {
125
+ "comments": [],
126
+ "cells": ["meeting"],
127
+ "line": 21
128
+ }
129
+ ]
130
+ }
131
+ ]
132
+ },
133
+ {
134
+ "comments": [],
135
+ "tags": [],
136
+ "keyword": "Scenario",
137
+ "name": "who stole my mojo?",
138
+ "description": "",
139
+ "type": "scenario",
140
+ "line": 23,
141
+ "steps": [
142
+ {
143
+ "comments": [],
144
+ "keyword": "When ",
145
+ "name": "I was",
146
+ "line": 24,
147
+ "multiline_arg": {
148
+ "type": "table",
149
+ "value": [
150
+ {
151
+ "comments": [],
152
+ "line": 25,
153
+ "cells": ["asleep"]
154
+ }
155
+ ]
156
+ }
157
+ },
158
+ {
159
+ "comments": [],
160
+ "keyword": "And ",
161
+ "name": "so",
162
+ "line": 26,
163
+ "multiline_arg": {
164
+ "type": "py_string",
165
+ "value": "innocent",
166
+ "line": 27
167
+ }
168
+ }
169
+ ]
170
+ },
171
+ {
172
+ "comments": [{"value": "# The"}],
173
+ "tags": [],
174
+ "keyword": "Scenario Outline",
175
+ "description": "",
176
+ "type": "scenario_outline",
177
+ "line": 32,
178
+ "name": "with",
179
+ "steps": [
180
+ {
181
+ "comments": [{"value": "# all"}],
182
+ "keyword": "Then ",
183
+ "line": 34,
184
+ "name": "nice"
185
+ }
186
+ ],
187
+ "examples": [
188
+ {
189
+ "type": "examples",
190
+ "comments": [{"value": "# comments"}, {"value": "# everywhere"}],
191
+ "tags": [],
192
+ "keyword": "Examples",
193
+ "name": "An example",
194
+ "description": "",
195
+ "line": 38,
196
+ "rows": [
197
+ {
198
+ "comments": [{"value": "# I mean"}],
199
+ "line": 40,
200
+ "cells": ["partout"]
201
+ },
202
+ {
203
+ "comments": [{"value": "# I really mean"}],
204
+ "line": 40,
205
+ "cells": ["bartout"]
206
+ }
207
+ ]
208
+ }
209
+ ]
210
+ }
211
+ ]
212
+ }
213
+ """
214
+ Then the outputted text should be:
215
+ """
216
+ @one
217
+ Feature: OH HAI
218
+
219
+ Scenario: Fujin
220
+ Given wind
221
+ Then spirit
222
+
223
+ @two
224
+ Scenario: _why
225
+ Given chunky
226
+ Then bacon
227
+
228
+ @three @four
229
+ Scenario Outline: Life
230
+ Given some <boredom>
231
+
232
+ @five
233
+ Examples: Real life
234
+ | boredom |
235
+ | airport |
236
+ | meeting |
237
+
238
+ Scenario: who stole my mojo?
239
+ When I was
240
+ | asleep |
241
+ And so
242
+ \"\"\"
243
+ innocent
244
+ \"\"\"
245
+
246
+ # The
247
+ Scenario Outline: with
248
+ # all
249
+ Then nice
250
+
251
+ # comments
252
+ # everywhere
253
+ Examples: An example
254
+ # I mean
255
+ | partout |
256
+ # I really mean
257
+ | bartout |
258
+ """
259
+
260
+ Scenario: Feature with Background
261
+ Given the following JSON is parsed:
262
+ """
263
+ {
264
+ "comments": [],
265
+ "description": "",
266
+ "keyword": "Feature",
267
+ "name": "Kjapp",
268
+ "tags": [],
269
+ "uri": "test.feature",
270
+ "elements": [
271
+ {
272
+ "type": "background",
273
+ "comments": [],
274
+ "description": "",
275
+ "keyword": "Background",
276
+ "line": 2,
277
+ "name": "No idea what Kjapp means",
278
+ "steps": [
279
+ {
280
+ "comments": [],
281
+ "keyword": "Given ",
282
+ "line": 3,
283
+ "name": "I Google it"
284
+ }
285
+ ]
286
+ },
287
+ {
288
+ "type": "scenario",
289
+ "comments": [{"value": "# Writing JSON by hand sucks"}],
290
+ "tags": [],
291
+ "keyword": "Scenario",
292
+ "name": "",
293
+ "description": "",
294
+ "line": 6,
295
+ "steps": [
296
+ {
297
+ "comments": [],
298
+ "keyword": "Then ",
299
+ "name": "I think it means \"fast\"",
300
+ "line": 7
301
+ }
302
+ ]
303
+ }
304
+ ]
305
+ }
306
+ """
307
+ Then the outputted text should be:
308
+ """
309
+ Feature: Kjapp
310
+
311
+ Background: No idea what Kjapp means
312
+ Given I Google it
313
+
314
+ # Writing JSON by hand sucks
315
+ Scenario:
316
+ Then I think it means "fast"
317
+ """
318
+
@@ -0,0 +1,19 @@
1
+ Feature: Native (C/Java) Lexer
2
+
3
+ Background:
4
+ Given a "native" "root" parser
5
+
6
+ Scenario: Parsing an empty feature
7
+ Given the following text is parsed:
8
+ """
9
+ Feature: blah
10
+ """
11
+ Then there should be no parse errors
12
+
13
+ Scenario: Parsing a comment
14
+ Given the following text is parsed:
15
+ """
16
+ # A comment
17
+ Feature: Hello
18
+ """
19
+ Then there should be no parse errors
@@ -0,0 +1,205 @@
1
+ Feature: Gherkin Feature lexer/parser
2
+ In order to make it easy to control the Gherkin syntax
3
+ As a Gherkin developer bent on Gherkin world-domination
4
+ I want a feature lexer that uses a feature parser to
5
+ make all the syntax decisions for me
6
+
7
+ Background:
8
+ Given a "native" "root" parser
9
+
10
+ Scenario: Correctly formed feature
11
+ When the following text is parsed:
12
+ """
13
+ # Apologies to Bill Watterson
14
+ @cardboard_box @wip
15
+ Feature: Transmogrification
16
+ As a young boy with a hyperactive imagination
17
+ I want a cardboard box
18
+ In order to transform the ennui of suburban life into something
19
+ befitting my imagination
20
+
21
+ Background:
22
+ Given I have a transmogrifier
23
+ And I am a member of G.R.O.S.S
24
+
25
+ Scenario: Whoozit to whatzit transmogrification
26
+ Given I have a whoozit
27
+ When I put it in the transmogrifier
28
+ And I press the "transmogrify" button
29
+ Then I should have a whatzit
30
+
31
+ Scenario Outline: Imaginary Beings
32
+ Given I have a <boring being>
33
+ When I transmogrify it with the incantation:
34
+ \"\"\"
35
+ ALAKAZAM!
36
+ \"\"\"
37
+ Then I should have an <exciting being>
38
+
39
+ Examples:
40
+ | boring being | exciting being |
41
+ | Sparrow | Alicanto |
42
+ | Goldfish | Baldanders |
43
+ | Cow | Hsiao |
44
+
45
+ Scenario: Sense of humor detection
46
+ Given the following excerpt:
47
+ \"\"\"
48
+ WOMAN: Who are the Britons?
49
+ ARTHUR: Well, we all are. we're all Britons and I am your king.
50
+ WOMAN: I didn't know we had a king. I thought we were an autonomous
51
+ collective.
52
+ DENNIS: You're fooling yourself. We're living in a dictatorship.
53
+ A self-perpetuating autocracy in which the working classes--
54
+ WOMAN: Oh there you go, bringing class into it again.
55
+ DENNIS: That's what it's all about if only people would--
56
+ ARTHUR: Please, please good people. I am in haste. Who lives
57
+ in that castle?
58
+ \"\"\"
59
+ When I read it
60
+ Then I should be amused
61
+ """
62
+ Then there should be no parse errors
63
+
64
+ Scenario: Keyword before feature
65
+ When the following text is parsed:
66
+ """
67
+ Scenario: Bullying my way to the head of the line
68
+ Given I am a big bully of a scenario
69
+ Then I should be caught by the syntax police(y)
70
+
71
+ Feature: Too timid to stand up for myself
72
+ """
73
+ Then there should be parse errors on lines 1 through 3
74
+
75
+ Scenario: Tag ends background and scenario
76
+ When the following text is parsed:
77
+ """
78
+ Feature: test feature
79
+ Background:
80
+ Given a something
81
+ @tag
82
+ And something else
83
+
84
+ @foo
85
+ Scenario: my scenario
86
+ @tag
87
+ Given this is a step
88
+ @oh_hai
89
+ And this is a horrible idea
90
+ Then it shouldn't work
91
+ """
92
+ Then there should be parse errors on lines 5, 10 and 12
93
+
94
+ Scenario: Tables
95
+ When the following text is parsed:
96
+ """
97
+ Feature: Antiques Roadshow
98
+ Scenario Outline: Table
99
+ Given a <foo>
100
+ Then a <bar>
101
+
102
+ Examples:
103
+ | foo | bar |
104
+ | 42 | towel |
105
+ @hello
106
+ | 1 | prime |
107
+
108
+ Scenario: Table arguments
109
+ Given this step needs this table:
110
+ | foo | bar |
111
+ | one | two |
112
+ @tag
113
+ | aaa | bbb |
114
+ """
115
+ Then there should be parse errors on lines 10 and 17
116
+
117
+ Scenario: Multiline keyword descriptions
118
+ When the following text is parsed:
119
+ """
120
+ Feature: Documentation is fun
121
+ Scenario Outline: With lots of docs
122
+ We need lots of embedded documentation for some reason
123
+ \"\"\" # Not interpreted as a pystring, just plain text
124
+ Oh hai
125
+ \"\"\"
126
+
127
+ La la la
128
+
129
+ Examples:
130
+ | one | two |
131
+ | foo | bar |
132
+
133
+ \"\"\"
134
+ Oh Hello
135
+ \"\"\"
136
+
137
+ # Body of the scenario outline starts below
138
+ Given <something>
139
+ And something <else>
140
+
141
+ # The real examples table
142
+ Examples:
143
+ | something | else |
144
+ | orange | apple |
145
+ """
146
+ Then there should be no parse errors
147
+
148
+ Scenario: Scenario Outline with multiple Example groups
149
+ When the following text is parsed:
150
+ """
151
+ Feature: Outline Sample
152
+
153
+ Scenario: I have no steps
154
+
155
+ Scenario Outline: Test state
156
+ Given <state> without a table
157
+ Given <other_state> without a table
158
+
159
+ Examples: Rainbow colours
160
+ | state | other_state |
161
+ | missing | passing |
162
+ | passing | passing |
163
+ | failing | passing |
164
+
165
+ Examples: Only passing
166
+ | state | other_state |
167
+ | passing | passing |
168
+ """
169
+ Then there should be no parse errors
170
+
171
+ Scenario: Multiple Scenario Outlines with multiline outline steps
172
+ When the following text is parsed:
173
+ """
174
+ Feature: Test
175
+ Scenario Outline: with step tables
176
+ Given I have the following fruits in my pantry
177
+ | name | quantity |
178
+ | cucumbers | 10 |
179
+ | strawberrys | 5 |
180
+ | apricots | 7 |
181
+
182
+ When I eat <number> <fruits> from the pantry
183
+ Then I should have <left> <fruits> in the pantry
184
+
185
+ Examples:
186
+ | number | fruits | left |
187
+ | 2 | cucumbers | 8 |
188
+ | 4 | strawberrys | 1 |
189
+ | 2 | apricots | 5 |
190
+
191
+ Scenario Outline: placeholder in a multiline string
192
+ Given my shopping list
193
+ \"\"\"
194
+ Must buy some <fruits>
195
+ \"\"\"
196
+ Then my shopping list should equal
197
+ \"\"\"
198
+ Must buy some cucumbers
199
+ \"\"\"
200
+
201
+ Examples:
202
+ | fruits |
203
+ | cucumbers |
204
+ """
205
+ Then there should be no parse errors