gherkin 2.0.1 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,15 @@
1
+ == 2.0.2 (2010-06-16)
2
+
3
+ === New Features
4
+ * New JSON Lexer. (Gregory Hnatiuk)
5
+
6
+ === Bugfixes
7
+ * Fixed incorrect indentation for descriptions in Java. (Aslak Hellesøy)
8
+ * Fixed support for xx-yy languages and Hebrew and Indonesian (JDK bugs). (Aslak Hellesøy)
9
+
10
+ === Changed Features
11
+ * Examples are now nested inside the Scenario Outline in the JSON format. (Gregory Hnatiuk)
12
+
1
13
  == 2.0.1 (2010-06-15)
2
14
 
3
15
  The previous release had a missing gherkin.jar in the jruby gem. This release fixes that.
@@ -2,4 +2,4 @@
2
2
  :major: 2
3
3
  :minor: 0
4
4
  :build:
5
- :patch: 1
5
+ :patch: 2
@@ -25,7 +25,7 @@ Feature: JSON formatter
25
25
  }
26
26
  """
27
27
 
28
- Scenario: Feature with two scenarios
28
+ Scenario: Feature with scenarios and outlines
29
29
  Given the following text is parsed:
30
30
  """
31
31
  @one
@@ -85,21 +85,20 @@ Feature: JSON formatter
85
85
  "keyword": "Scenario",
86
86
  "name": "Fujin",
87
87
  "description": "",
88
+ "type": "scenario",
88
89
  "line": 4,
89
90
  "steps": [
90
91
  {
91
92
  "comments": [],
92
93
  "keyword": "Given ",
93
94
  "name": "wind",
94
- "line": 5,
95
- "multiline_arg": null
95
+ "line": 5
96
96
  },
97
97
  {
98
98
  "comments": [],
99
99
  "keyword": "Then ",
100
100
  "name": "spirit",
101
- "line": 6,
102
- "multiline_arg": null
101
+ "line": 6
103
102
  }
104
103
  ]
105
104
  },
@@ -109,21 +108,20 @@ Feature: JSON formatter
109
108
  "keyword": "Scenario",
110
109
  "name": "_why",
111
110
  "description": "",
111
+ "type": "scenario",
112
112
  "line": 9,
113
113
  "steps": [
114
114
  {
115
115
  "comments": [],
116
116
  "keyword": "Given ",
117
117
  "name": "chunky",
118
- "line": 10,
119
- "multiline_arg": null
118
+ "line": 10
120
119
  },
121
120
  {
122
121
  "comments": [],
123
122
  "keyword": "Then ",
124
123
  "name": "bacon",
125
- "line": 11,
126
- "multiline_arg": null
124
+ "line": 11
127
125
  }
128
126
  ]
129
127
  },
@@ -133,39 +131,41 @@ Feature: JSON formatter
133
131
  "keyword": "Scenario Outline",
134
132
  "name": "Life",
135
133
  "description": "",
134
+ "type": "scenario_outline",
136
135
  "line": 14,
137
136
  "steps": [
138
137
  {
139
138
  "comments": [],
140
139
  "keyword": "Given ",
141
140
  "name": "some <boredom>",
142
- "line": 15,
143
- "multiline_arg": null
141
+ "line": 15
144
142
  }
145
- ]
146
- },
147
- {
148
- "comments": [],
149
- "tags": ["@five"],
150
- "keyword": "Examples",
151
- "name": "Real life",
152
- "description": "",
153
- "line": 18,
154
- "examples_table": [
155
- {
156
- "comments": [],
157
- "cells": ["boredom"],
158
- "line": 19
159
- },
160
- {
161
- "comments": [],
162
- "cells": ["airport"],
163
- "line": 20
164
- },
143
+ ],
144
+ "examples": [
165
145
  {
166
146
  "comments": [],
167
- "cells": ["meeting"],
168
- "line": 21
147
+ "tags": ["@five"],
148
+ "keyword": "Examples",
149
+ "name": "Real life",
150
+ "description": "",
151
+ "line": 18,
152
+ "table": [
153
+ {
154
+ "comments": [],
155
+ "cells": ["boredom"],
156
+ "line": 19
157
+ },
158
+ {
159
+ "comments": [],
160
+ "cells": ["airport"],
161
+ "line": 20
162
+ },
163
+ {
164
+ "comments": [],
165
+ "cells": ["meeting"],
166
+ "line": 21
167
+ }
168
+ ]
169
169
  }
170
170
  ]
171
171
  },
@@ -175,6 +175,7 @@ Feature: JSON formatter
175
175
  "keyword": "Scenario",
176
176
  "name": "who stole my mojo?",
177
177
  "description": "",
178
+ "type": "scenario",
178
179
  "line": 23,
179
180
  "steps": [
180
181
  {
@@ -182,7 +183,7 @@ Feature: JSON formatter
182
183
  "keyword": "When ",
183
184
  "name": "I was",
184
185
  "line": 24,
185
- "multiline_arg": [
186
+ "table": [
186
187
  {
187
188
  "comments": [],
188
189
  "line": 25,
@@ -195,7 +196,7 @@ Feature: JSON formatter
195
196
  "keyword": "And ",
196
197
  "name": "so",
197
198
  "line": 26,
198
- "multiline_arg": "innocent"
199
+ "py_string": "innocent"
199
200
  }
200
201
  ]
201
202
  },
@@ -204,6 +205,7 @@ Feature: JSON formatter
204
205
  "tags": [],
205
206
  "keyword": "Scenario Outline",
206
207
  "description": "",
208
+ "type": "scenario_outline",
207
209
  "line": 32,
208
210
  "name": "with",
209
211
  "steps": [
@@ -211,28 +213,86 @@ Feature: JSON formatter
211
213
  "comments": ["# all"],
212
214
  "keyword": "Then ",
213
215
  "line": 34,
214
- "name": "nice",
215
- "multiline_arg": null
216
+ "name": "nice"
217
+ }
218
+ ],
219
+ "examples": [
220
+ {
221
+ "comments": ["# comments", "# everywhere"],
222
+ "tags": [],
223
+ "keyword": "Examples",
224
+ "name": "An example",
225
+ "description": "",
226
+ "line": 38,
227
+ "table": [
228
+ {
229
+ "comments": ["# I mean"],
230
+ "line": 40,
231
+ "cells": ["partout"]
232
+ }
233
+ ]
216
234
  }
217
235
  ]
218
- },
236
+ }
237
+ ]
238
+ }
239
+ """
240
+
241
+ Scenario: Feature with Background
242
+ Given the following text is parsed:
243
+ """
244
+ Feature: Kjapp
245
+
246
+ Background: No idea what Kjapp means
247
+ Given I Google it
248
+
249
+ # Writing JSON by hand sucks
250
+ Scenario:
251
+ Then I think it means "fast"
252
+ """
253
+ Then the outputted JSON should be:
254
+ """
255
+ {
256
+ "comments": [],
257
+ "description": "",
258
+ "keyword": "Feature",
259
+ "name": "Kjapp",
260
+ "tags": [],
261
+ "uri": "test.feature",
262
+ "background": {
263
+ "comments": [],
264
+ "description": "",
265
+ "keyword": "Background",
266
+ "line": 3,
267
+ "name": "No idea what Kjapp means",
268
+ "steps": [
269
+ {
270
+ "comments": [],
271
+ "keyword": "Given ",
272
+ "line": 4,
273
+ "name": "I Google it"
274
+ }
275
+ ]
276
+ },
277
+ "elements": [
219
278
  {
220
- "comments": ["# comments", "# everywhere"],
279
+ "comments": ["# Writing JSON by hand sucks"],
221
280
  "tags": [],
222
- "keyword": "Examples",
223
- "name": "An example",
224
- // TODO - the description should now be the comment
225
- // It should be on the first row of the examples_table!
226
- "description": "# I mean",
227
- "line": 38,
228
- "examples_table": [
281
+ "keyword": "Scenario",
282
+ "name": "",
283
+ "description": "",
284
+ "type": "scenario",
285
+ "line": 7,
286
+ "steps": [
229
287
  {
230
288
  "comments": [],
231
- "line": 40,
232
- "cells": ["partout"]
289
+ "keyword": "Then ",
290
+ "name": "I think it means \"fast\"",
291
+ "line": 8
233
292
  }
234
293
  ]
235
294
  }
236
295
  ]
237
296
  }
238
297
  """
298
+
@@ -0,0 +1,307 @@
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": ["# language: no", "# Another comment"],
14
+ "description": "",
15
+ "keyword": "Egenskap",
16
+ "name": "Kjapp",
17
+ "tags": [],
18
+ "uri": "test.feature"
19
+ }
20
+ """
21
+ Then the outputted text should be:
22
+ """
23
+ # language: no
24
+ # Another comment
25
+ Egenskap: Kjapp
26
+ """
27
+
28
+ Scenario: Feature with scenarios and outlines
29
+ Given the following JSON is parsed:
30
+ """
31
+ {
32
+ "comments": [],
33
+ "keyword": "Feature",
34
+ "name": "OH HAI",
35
+ "tags": ["@one"],
36
+ "uri": "test.feature",
37
+ "description": "",
38
+ "elements":[
39
+ {
40
+ "comments": [],
41
+ "tags": [],
42
+ "keyword": "Scenario",
43
+ "name": "Fujin",
44
+ "description": "",
45
+ "type": "scenario",
46
+ "line": 4,
47
+ "steps": [
48
+ {
49
+ "comments": [],
50
+ "keyword": "Given ",
51
+ "name": "wind",
52
+ "line": 5
53
+ },
54
+ {
55
+ "comments": [],
56
+ "keyword": "Then ",
57
+ "name": "spirit",
58
+ "line": 6
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "comments": [],
64
+ "tags": ["@two"],
65
+ "keyword": "Scenario",
66
+ "name": "_why",
67
+ "description": "",
68
+ "type": "scenario",
69
+ "line": 9,
70
+ "steps": [
71
+ {
72
+ "comments": [],
73
+ "keyword": "Given ",
74
+ "name": "chunky",
75
+ "line": 10
76
+ },
77
+ {
78
+ "comments": [],
79
+ "keyword": "Then ",
80
+ "name": "bacon",
81
+ "line": 11
82
+ }
83
+ ]
84
+ },
85
+ {
86
+ "comments": [],
87
+ "tags": ["@three", "@four"],
88
+ "keyword": "Scenario Outline",
89
+ "name": "Life",
90
+ "description": "",
91
+ "type": "scenario_outline",
92
+ "line": 14,
93
+ "steps": [
94
+ {
95
+ "comments": [],
96
+ "keyword": "Given ",
97
+ "name": "some <boredom>",
98
+ "line": 15
99
+ }
100
+ ],
101
+ "examples": [
102
+ {
103
+ "comments": [],
104
+ "tags": ["@five"],
105
+ "keyword": "Examples",
106
+ "name": "Real life",
107
+ "description": "",
108
+ "line": 18,
109
+ "table": [
110
+ {
111
+ "comments": [],
112
+ "cells": ["boredom"],
113
+ "line": 19
114
+ },
115
+ {
116
+ "comments": [],
117
+ "cells": ["airport"],
118
+ "line": 20
119
+ },
120
+ {
121
+ "comments": [],
122
+ "cells": ["meeting"],
123
+ "line": 21
124
+ }
125
+ ]
126
+ }
127
+ ]
128
+ },
129
+ {
130
+ "comments": [],
131
+ "tags": [],
132
+ "keyword": "Scenario",
133
+ "name": "who stole my mojo?",
134
+ "description": "",
135
+ "type": "scenario",
136
+ "line": 23,
137
+ "steps": [
138
+ {
139
+ "comments": [],
140
+ "keyword": "When ",
141
+ "name": "I was",
142
+ "line": 24,
143
+ "table": [
144
+ {
145
+ "comments": [],
146
+ "line": 25,
147
+ "cells": ["asleep"]
148
+ }
149
+ ]
150
+ },
151
+ {
152
+ "comments": [],
153
+ "keyword": "And ",
154
+ "name": "so",
155
+ "line": 26,
156
+ "py_string": "innocent"
157
+ }
158
+ ]
159
+ },
160
+ {
161
+ "comments": ["# The"],
162
+ "tags": [],
163
+ "keyword": "Scenario Outline",
164
+ "description": "",
165
+ "type": "scenario_outline",
166
+ "line": 32,
167
+ "name": "with",
168
+ "steps": [
169
+ {
170
+ "comments": ["# all"],
171
+ "keyword": "Then ",
172
+ "line": 34,
173
+ "name": "nice"
174
+ }
175
+ ],
176
+ "examples": [
177
+ {
178
+ "comments": ["# comments", "# everywhere"],
179
+ "tags": [],
180
+ "keyword": "Examples",
181
+ "name": "An example",
182
+ // TODO - the description should now be the comment
183
+ // It should be on the first row of the examples_table!
184
+ "description": "",
185
+ "line": 38,
186
+ "table": [
187
+ {
188
+ "comments": ["# I mean"],
189
+ "line": 40,
190
+ "cells": ["partout"]
191
+ },
192
+ {
193
+ "comments": ["# I really mean"],
194
+ "line": 40,
195
+ "cells": ["bartout"]
196
+ }
197
+ ]
198
+ }
199
+ ]
200
+ }
201
+ ]
202
+ }
203
+ """
204
+ Then the outputted text should be:
205
+ """
206
+ @one
207
+ Feature: OH HAI
208
+
209
+ Scenario: Fujin
210
+ Given wind
211
+ Then spirit
212
+
213
+ @two
214
+ Scenario: _why
215
+ Given chunky
216
+ Then bacon
217
+
218
+ @three @four
219
+ Scenario Outline: Life
220
+ Given some <boredom>
221
+
222
+ @five
223
+ Examples: Real life
224
+ | boredom |
225
+ | airport |
226
+ | meeting |
227
+
228
+ Scenario: who stole my mojo?
229
+ When I was
230
+ | asleep |
231
+ And so
232
+ \"\"\"
233
+ innocent
234
+ \"\"\"
235
+
236
+ # The
237
+ Scenario Outline: with
238
+ # all
239
+ Then nice
240
+
241
+ # comments
242
+ # everywhere
243
+ Examples: An example
244
+ # I mean
245
+ | partout |
246
+ # I really mean
247
+ | bartout |
248
+ """
249
+
250
+ Scenario: Feature with Background
251
+ Given the following JSON is parsed:
252
+ """
253
+ {
254
+ "comments": [],
255
+ "description": "",
256
+ "keyword": "Feature",
257
+ "name": "Kjapp",
258
+ "tags": [],
259
+ "uri": "test.feature",
260
+ "background": {
261
+ "comments": [],
262
+ "description": "",
263
+ "keyword": "Background",
264
+ "line": 2,
265
+ "name": "No idea what Kjapp means",
266
+ "steps": [
267
+ {
268
+ "comments": [],
269
+ "keyword": "Given ",
270
+ "line": 3,
271
+ "name": "I Google it"
272
+ }
273
+ ]
274
+ },
275
+ "elements": [
276
+ {
277
+ "comments": ["# Writing JSON by hand sucks"],
278
+ "tags": [],
279
+ "keyword": "Scenario",
280
+ "name": "",
281
+ "description": "",
282
+ "type": "scenario",
283
+ "line": 6,
284
+ "steps": [
285
+ {
286
+ "comments": [],
287
+ "keyword": "Then ",
288
+ "name": "I think it means \"fast\"",
289
+ "line": 7
290
+ }
291
+ ]
292
+ }
293
+ ]
294
+ }
295
+ """
296
+ Then the outputted text should be:
297
+ """
298
+ Feature: Kjapp
299
+
300
+ Background: No idea what Kjapp means
301
+ Given I Google it
302
+
303
+ # Writing JSON by hand sucks
304
+ Scenario:
305
+ Then I think it means "fast"
306
+ """
307
+