benhamill-gherkin 2.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitattributes +2 -0
- data/.gitignore +11 -0
- data/.mailmap +2 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/Gemfile +7 -0
- data/History.txt +363 -0
- data/LICENSE +20 -0
- data/README.rdoc +149 -0
- data/Rakefile +19 -0
- data/VERSION +1 -0
- data/build_native_gems.sh +8 -0
- data/cucumber.yml +3 -0
- data/features/escaped_pipes.feature +8 -0
- data/features/feature_parser.feature +237 -0
- data/features/json_formatter.feature +377 -0
- data/features/json_parser.feature +318 -0
- data/features/native_lexer.feature +19 -0
- data/features/parser_with_native_lexer.feature +205 -0
- data/features/pretty_formatter.feature +15 -0
- data/features/step_definitions/eyeball_steps.rb +3 -0
- data/features/step_definitions/gherkin_steps.rb +29 -0
- data/features/step_definitions/json_formatter_steps.rb +28 -0
- data/features/step_definitions/json_parser_steps.rb +20 -0
- data/features/step_definitions/pretty_formatter_steps.rb +84 -0
- data/features/steps_parser.feature +46 -0
- data/features/support/env.rb +38 -0
- data/gherkin.gemspec +61 -0
- data/ikvm/.gitignore +3 -0
- data/java/.gitignore +5 -0
- data/java/src/main/java/gherkin/lexer/i18n/.gitignore +1 -0
- data/java/src/main/resources/gherkin/.gitignore +1 -0
- data/js/lib/gherkin/lexer/i18n/ar.js +1094 -0
- data/js/lib/gherkin/lexer/i18n/bg.js +1308 -0
- data/js/lib/gherkin/lexer/i18n/ca.js +1236 -0
- data/js/lib/gherkin/lexer/i18n/cs.js +1090 -0
- data/js/lib/gherkin/lexer/i18n/cy_gb.js +958 -0
- data/js/lib/gherkin/lexer/i18n/da.js +974 -0
- data/js/lib/gherkin/lexer/i18n/de.js +1082 -0
- data/js/lib/gherkin/lexer/i18n/en.js +965 -0
- data/js/lib/gherkin/lexer/i18n/en_au.js +902 -0
- data/js/lib/gherkin/lexer/i18n/en_lol.js +859 -0
- data/js/lib/gherkin/lexer/i18n/en_pirate.js +1136 -0
- data/js/lib/gherkin/lexer/i18n/en_scouse.js +1289 -0
- data/js/lib/gherkin/lexer/i18n/en_tx.js +942 -0
- data/js/lib/gherkin/lexer/i18n/eo.js +916 -0
- data/js/lib/gherkin/lexer/i18n/es.js +1049 -0
- data/js/lib/gherkin/lexer/i18n/et.js +915 -0
- data/js/lib/gherkin/lexer/i18n/fi.js +894 -0
- data/js/lib/gherkin/lexer/i18n/fr.js +1116 -0
- data/js/lib/gherkin/lexer/i18n/he.js +1044 -0
- data/js/lib/gherkin/lexer/i18n/hr.js +994 -0
- data/js/lib/gherkin/lexer/i18n/hu.js +1043 -0
- data/js/lib/gherkin/lexer/i18n/id.js +884 -0
- data/js/lib/gherkin/lexer/i18n/it.js +1007 -0
- data/js/lib/gherkin/lexer/i18n/ja.js +1344 -0
- data/js/lib/gherkin/lexer/i18n/ko.js +1028 -0
- data/js/lib/gherkin/lexer/i18n/lt.js +972 -0
- data/js/lib/gherkin/lexer/i18n/lu.js +1057 -0
- data/js/lib/gherkin/lexer/i18n/lv.js +1092 -0
- data/js/lib/gherkin/lexer/i18n/nl.js +1036 -0
- data/js/lib/gherkin/lexer/i18n/no.js +986 -0
- data/js/lib/gherkin/lexer/i18n/pl.js +1140 -0
- data/js/lib/gherkin/lexer/i18n/pt.js +1000 -0
- data/js/lib/gherkin/lexer/i18n/ro.js +1089 -0
- data/js/lib/gherkin/lexer/i18n/ru.js +1560 -0
- data/js/lib/gherkin/lexer/i18n/sk.js +972 -0
- data/js/lib/gherkin/lexer/i18n/sr_cyrl.js +1728 -0
- data/js/lib/gherkin/lexer/i18n/sr_latn.js +1220 -0
- data/js/lib/gherkin/lexer/i18n/sv.js +997 -0
- data/js/lib/gherkin/lexer/i18n/tr.js +1014 -0
- data/js/lib/gherkin/lexer/i18n/uk.js +1572 -0
- data/js/lib/gherkin/lexer/i18n/uz.js +1302 -0
- data/js/lib/gherkin/lexer/i18n/vi.js +1124 -0
- data/js/lib/gherkin/lexer/i18n/zh_cn.js +902 -0
- data/js/lib/gherkin/lexer/i18n/zh_tw.js +940 -0
- data/lib/.gitignore +4 -0
- data/lib/gherkin.rb +2 -0
- data/lib/gherkin/c_lexer.rb +17 -0
- data/lib/gherkin/formatter/ansi_escapes.rb +95 -0
- data/lib/gherkin/formatter/argument.rb +16 -0
- data/lib/gherkin/formatter/escaping.rb +15 -0
- data/lib/gherkin/formatter/filter_formatter.rb +136 -0
- data/lib/gherkin/formatter/hashable.rb +19 -0
- data/lib/gherkin/formatter/json_formatter.rb +102 -0
- data/lib/gherkin/formatter/line_filter.rb +26 -0
- data/lib/gherkin/formatter/model.rb +236 -0
- data/lib/gherkin/formatter/pretty_formatter.rb +243 -0
- data/lib/gherkin/formatter/regexp_filter.rb +21 -0
- data/lib/gherkin/formatter/step_printer.rb +17 -0
- data/lib/gherkin/formatter/tag_count_formatter.rb +47 -0
- data/lib/gherkin/formatter/tag_filter.rb +19 -0
- data/lib/gherkin/i18n.rb +175 -0
- data/lib/gherkin/i18n.yml +588 -0
- data/lib/gherkin/json_parser.rb +137 -0
- data/lib/gherkin/lexer/i18n_lexer.rb +47 -0
- data/lib/gherkin/listener/event.rb +45 -0
- data/lib/gherkin/listener/formatter_listener.rb +113 -0
- data/lib/gherkin/native.rb +7 -0
- data/lib/gherkin/native/ikvm.rb +55 -0
- data/lib/gherkin/native/java.rb +55 -0
- data/lib/gherkin/native/null.rb +9 -0
- data/lib/gherkin/parser/meta.txt +5 -0
- data/lib/gherkin/parser/parser.rb +164 -0
- data/lib/gherkin/parser/root.txt +11 -0
- data/lib/gherkin/parser/steps.txt +4 -0
- data/lib/gherkin/rb_lexer.rb +8 -0
- data/lib/gherkin/rb_lexer/.gitignore +1 -0
- data/lib/gherkin/rb_lexer/README.rdoc +8 -0
- data/lib/gherkin/rubify.rb +24 -0
- data/lib/gherkin/tag_expression.rb +62 -0
- data/lib/gherkin/version.rb +3 -0
- data/ragel/i18n/.gitignore +1 -0
- data/ragel/lexer.c.rl.erb +439 -0
- data/ragel/lexer.java.rl.erb +208 -0
- data/ragel/lexer.rb.rl.erb +167 -0
- data/ragel/lexer_common.rl.erb +50 -0
- data/spec/gherkin/c_lexer_spec.rb +21 -0
- data/spec/gherkin/fixtures/1.feature +8 -0
- data/spec/gherkin/fixtures/comments_in_table.feature +9 -0
- data/spec/gherkin/fixtures/complex.feature +45 -0
- data/spec/gherkin/fixtures/complex.json +143 -0
- data/spec/gherkin/fixtures/complex_for_filtering.feature +60 -0
- data/spec/gherkin/fixtures/complex_with_tags.feature +61 -0
- data/spec/gherkin/fixtures/dos_line_endings.feature +45 -0
- data/spec/gherkin/fixtures/hantu_pisang.feature +35 -0
- data/spec/gherkin/fixtures/i18n_fr.feature +14 -0
- data/spec/gherkin/fixtures/i18n_no.feature +7 -0
- data/spec/gherkin/fixtures/i18n_zh-CN.feature +9 -0
- data/spec/gherkin/fixtures/scenario_outline_with_tags.feature +13 -0
- data/spec/gherkin/fixtures/scenario_without_steps.feature +5 -0
- data/spec/gherkin/fixtures/simple_with_comments.feature +7 -0
- data/spec/gherkin/fixtures/simple_with_tags.feature +11 -0
- data/spec/gherkin/fixtures/with_bom.feature +3 -0
- data/spec/gherkin/formatter/ansi_escapes_spec.rb +19 -0
- data/spec/gherkin/formatter/filter_formatter_spec.rb +165 -0
- data/spec/gherkin/formatter/model_spec.rb +28 -0
- data/spec/gherkin/formatter/pretty_formatter_spec.rb +158 -0
- data/spec/gherkin/formatter/spaces.feature +9 -0
- data/spec/gherkin/formatter/step_printer_spec.rb +55 -0
- data/spec/gherkin/formatter/tabs.feature +9 -0
- data/spec/gherkin/formatter/tag_count_formatter_spec.rb +30 -0
- data/spec/gherkin/i18n_spec.rb +152 -0
- data/spec/gherkin/java_lexer_spec.rb +20 -0
- data/spec/gherkin/java_libs.rb +20 -0
- data/spec/gherkin/json_parser_spec.rb +113 -0
- data/spec/gherkin/lexer/i18n_lexer_spec.rb +43 -0
- data/spec/gherkin/output_stream_string_io.rb +20 -0
- data/spec/gherkin/parser/parser_spec.rb +16 -0
- data/spec/gherkin/rb_lexer_spec.rb +19 -0
- data/spec/gherkin/sexp_recorder.rb +56 -0
- data/spec/gherkin/shared/lexer_group.rb +593 -0
- data/spec/gherkin/shared/py_string_group.rb +153 -0
- data/spec/gherkin/shared/row_group.rb +125 -0
- data/spec/gherkin/shared/tags_group.rb +54 -0
- data/spec/gherkin/tag_expression_spec.rb +137 -0
- data/spec/spec_helper.rb +69 -0
- data/tasks/bench.rake +184 -0
- data/tasks/bench/feature_builder.rb +49 -0
- data/tasks/bench/generated/.gitignore +1 -0
- data/tasks/bench/null_listener.rb +4 -0
- data/tasks/compile.rake +102 -0
- data/tasks/cucumber.rake +20 -0
- data/tasks/gems.rake +35 -0
- data/tasks/ikvm.rake +79 -0
- data/tasks/ragel_task.rb +70 -0
- data/tasks/rdoc.rake +9 -0
- data/tasks/release.rake +30 -0
- data/tasks/rspec.rake +8 -0
- metadata +609 -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
|