bryanl-gherkin 2.11.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. data/.gitattributes +2 -0
  2. data/.mailmap +2 -0
  3. data/.rbenv-gemsets +1 -0
  4. data/.rspec +1 -0
  5. data/.rvmrc +1 -0
  6. data/.travis.yml +16 -0
  7. data/.yardopts +5 -0
  8. data/Gemfile +5 -0
  9. data/History.md +788 -0
  10. data/LICENSE +20 -0
  11. data/README.md +272 -0
  12. data/Rakefile +26 -0
  13. data/build_native_gems.sh +7 -0
  14. data/cucumber.yml +4 -0
  15. data/examples/parse_and_output_json.rb +19 -0
  16. data/features/.cucumber/stepdefs.json +244 -0
  17. data/features/escaped_pipes.feature +8 -0
  18. data/features/feature_parser.feature +237 -0
  19. data/features/json_formatter.feature +498 -0
  20. data/features/json_parser.feature +331 -0
  21. data/features/native_lexer.feature +19 -0
  22. data/features/parser_with_native_lexer.feature +205 -0
  23. data/features/pretty_formatter.feature +16 -0
  24. data/features/step_definitions/eyeball_steps.rb +3 -0
  25. data/features/step_definitions/gherkin_steps.rb +29 -0
  26. data/features/step_definitions/json_formatter_steps.rb +30 -0
  27. data/features/step_definitions/json_parser_steps.rb +20 -0
  28. data/features/step_definitions/pretty_formatter_steps.rb +85 -0
  29. data/features/steps_parser.feature +46 -0
  30. data/features/support/env.rb +42 -0
  31. data/gherkin.gemspec +77 -0
  32. data/install_mingw_os_x.sh +7 -0
  33. data/js/.npmignore +1 -0
  34. data/js/lib/gherkin/lexer/.npmignore +0 -0
  35. data/lib/gherkin.rb +2 -0
  36. data/lib/gherkin/c_lexer.rb +17 -0
  37. data/lib/gherkin/formatter/ansi_escapes.rb +97 -0
  38. data/lib/gherkin/formatter/argument.rb +16 -0
  39. data/lib/gherkin/formatter/escaping.rb +15 -0
  40. data/lib/gherkin/formatter/filter_formatter.rb +146 -0
  41. data/lib/gherkin/formatter/hashable.rb +19 -0
  42. data/lib/gherkin/formatter/json_formatter.rb +122 -0
  43. data/lib/gherkin/formatter/line_filter.rb +26 -0
  44. data/lib/gherkin/formatter/model.rb +281 -0
  45. data/lib/gherkin/formatter/pretty_formatter.rb +244 -0
  46. data/lib/gherkin/formatter/regexp_filter.rb +21 -0
  47. data/lib/gherkin/formatter/step_printer.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 +613 -0
  52. data/lib/gherkin/js_lexer.rb +20 -0
  53. data/lib/gherkin/json_parser.rb +177 -0
  54. data/lib/gherkin/lexer/i18n_lexer.rb +46 -0
  55. data/lib/gherkin/listener/event.rb +45 -0
  56. data/lib/gherkin/listener/formatter_listener.rb +143 -0
  57. data/lib/gherkin/native.rb +7 -0
  58. data/lib/gherkin/native/java.rb +72 -0
  59. data/lib/gherkin/native/null.rb +5 -0
  60. data/lib/gherkin/native/therubyracer.rb +39 -0
  61. data/lib/gherkin/parser/meta.txt +5 -0
  62. data/lib/gherkin/parser/parser.rb +164 -0
  63. data/lib/gherkin/parser/root.txt +11 -0
  64. data/lib/gherkin/parser/steps.txt +4 -0
  65. data/lib/gherkin/rb_lexer.rb +8 -0
  66. data/lib/gherkin/rb_lexer/README.rdoc +8 -0
  67. data/lib/gherkin/rb_lexer/ar.rb +1165 -0
  68. data/lib/gherkin/rb_lexer/bg.rb +1377 -0
  69. data/lib/gherkin/rb_lexer/bm.rb +1081 -0
  70. data/lib/gherkin/rb_lexer/ca.rb +1305 -0
  71. data/lib/gherkin/rb_lexer/cs.rb +1157 -0
  72. data/lib/gherkin/rb_lexer/cy_gb.rb +1027 -0
  73. data/lib/gherkin/rb_lexer/da.rb +1043 -0
  74. data/lib/gherkin/rb_lexer/de.rb +1151 -0
  75. data/lib/gherkin/rb_lexer/en.rb +1151 -0
  76. data/lib/gherkin/rb_lexer/en_au.rb +971 -0
  77. data/lib/gherkin/rb_lexer/en_lol.rb +929 -0
  78. data/lib/gherkin/rb_lexer/en_pirate.rb +1205 -0
  79. data/lib/gherkin/rb_lexer/en_scouse.rb +1357 -0
  80. data/lib/gherkin/rb_lexer/en_tx.rb +1011 -0
  81. data/lib/gherkin/rb_lexer/eo.rb +990 -0
  82. data/lib/gherkin/rb_lexer/es.rb +1135 -0
  83. data/lib/gherkin/rb_lexer/et.rb +985 -0
  84. data/lib/gherkin/rb_lexer/fi.rb +964 -0
  85. data/lib/gherkin/rb_lexer/fr.rb +1223 -0
  86. data/lib/gherkin/rb_lexer/he.rb +1113 -0
  87. data/lib/gherkin/rb_lexer/hr.rb +1061 -0
  88. data/lib/gherkin/rb_lexer/hu.rb +1113 -0
  89. data/lib/gherkin/rb_lexer/id.rb +958 -0
  90. data/lib/gherkin/rb_lexer/is.rb +1115 -0
  91. data/lib/gherkin/rb_lexer/it.rb +1081 -0
  92. data/lib/gherkin/rb_lexer/ja.rb +1413 -0
  93. data/lib/gherkin/rb_lexer/ko.rb +1097 -0
  94. data/lib/gherkin/rb_lexer/lt.rb +1040 -0
  95. data/lib/gherkin/rb_lexer/lu.rb +1127 -0
  96. data/lib/gherkin/rb_lexer/lv.rb +1161 -0
  97. data/lib/gherkin/rb_lexer/nl.rb +1110 -0
  98. data/lib/gherkin/rb_lexer/no.rb +1055 -0
  99. data/lib/gherkin/rb_lexer/pl.rb +1452 -0
  100. data/lib/gherkin/rb_lexer/pt.rb +1425 -0
  101. data/lib/gherkin/rb_lexer/ro.rb +1159 -0
  102. data/lib/gherkin/rb_lexer/ru.rb +1749 -0
  103. data/lib/gherkin/rb_lexer/sk.rb +1041 -0
  104. data/lib/gherkin/rb_lexer/sr_cyrl.rb +1798 -0
  105. data/lib/gherkin/rb_lexer/sr_latn.rb +1289 -0
  106. data/lib/gherkin/rb_lexer/sv.rb +1065 -0
  107. data/lib/gherkin/rb_lexer/tr.rb +1087 -0
  108. data/lib/gherkin/rb_lexer/uk.rb +1641 -0
  109. data/lib/gherkin/rb_lexer/uz.rb +1371 -0
  110. data/lib/gherkin/rb_lexer/vi.rb +1193 -0
  111. data/lib/gherkin/rb_lexer/zh_cn.rb +1053 -0
  112. data/lib/gherkin/rb_lexer/zh_tw.rb +1047 -0
  113. data/lib/gherkin/rubify.rb +24 -0
  114. data/lib/gherkin/tag_expression.rb +62 -0
  115. data/ragel/lexer.c.rl.erb +454 -0
  116. data/ragel/lexer.java.rl.erb +219 -0
  117. data/ragel/lexer.js.rl.erb +227 -0
  118. data/ragel/lexer.rb.rl.erb +174 -0
  119. data/ragel/lexer_common.rl.erb +50 -0
  120. data/spec/gherkin/c_lexer_spec.rb +22 -0
  121. data/spec/gherkin/fixtures/1.feature +8 -0
  122. data/spec/gherkin/fixtures/comments_in_table.feature +9 -0
  123. data/spec/gherkin/fixtures/complex.feature +45 -0
  124. data/spec/gherkin/fixtures/complex.json +139 -0
  125. data/spec/gherkin/fixtures/complex_for_filtering.feature +60 -0
  126. data/spec/gherkin/fixtures/complex_with_tags.feature +61 -0
  127. data/spec/gherkin/fixtures/dos_line_endings.feature +45 -0
  128. data/spec/gherkin/fixtures/examples_with_only_header.feature +14 -0
  129. data/spec/gherkin/fixtures/hantu_pisang.feature +35 -0
  130. data/spec/gherkin/fixtures/i18n_fr.feature +14 -0
  131. data/spec/gherkin/fixtures/i18n_fr2.feature +8 -0
  132. data/spec/gherkin/fixtures/i18n_no.feature +7 -0
  133. data/spec/gherkin/fixtures/i18n_pt1.feature +44 -0
  134. data/spec/gherkin/fixtures/i18n_pt2.feature +4 -0
  135. data/spec/gherkin/fixtures/i18n_pt3.feature +4 -0
  136. data/spec/gherkin/fixtures/i18n_pt4.feature +4 -0
  137. data/spec/gherkin/fixtures/i18n_zh-CN.feature +9 -0
  138. data/spec/gherkin/fixtures/issue_145.feature +22 -0
  139. data/spec/gherkin/fixtures/scenario_outline_with_tags.feature +13 -0
  140. data/spec/gherkin/fixtures/scenario_without_steps.feature +5 -0
  141. data/spec/gherkin/fixtures/simple_with_comments.feature +7 -0
  142. data/spec/gherkin/fixtures/simple_with_tags.feature +11 -0
  143. data/spec/gherkin/fixtures/with_bom.feature +3 -0
  144. data/spec/gherkin/formatter/ansi_escapes_spec.rb +32 -0
  145. data/spec/gherkin/formatter/filter_formatter_spec.rb +204 -0
  146. data/spec/gherkin/formatter/json_formatter_spec.rb +92 -0
  147. data/spec/gherkin/formatter/model_spec.rb +28 -0
  148. data/spec/gherkin/formatter/pretty_formatter_spec.rb +177 -0
  149. data/spec/gherkin/formatter/spaces.feature +9 -0
  150. data/spec/gherkin/formatter/step_printer_spec.rb +55 -0
  151. data/spec/gherkin/formatter/tabs.feature +9 -0
  152. data/spec/gherkin/formatter/tag_count_formatter_spec.rb +30 -0
  153. data/spec/gherkin/i18n_spec.rb +241 -0
  154. data/spec/gherkin/java_lexer_spec.rb +20 -0
  155. data/spec/gherkin/js_lexer_spec.rb +23 -0
  156. data/spec/gherkin/json_parser_spec.rb +176 -0
  157. data/spec/gherkin/lexer/i18n_lexer_spec.rb +43 -0
  158. data/spec/gherkin/output_stream_string_io.rb +20 -0
  159. data/spec/gherkin/parser/parser_spec.rb +16 -0
  160. data/spec/gherkin/rb_lexer_spec.rb +20 -0
  161. data/spec/gherkin/sexp_recorder.rb +59 -0
  162. data/spec/gherkin/shared/bom_group.rb +20 -0
  163. data/spec/gherkin/shared/doc_string_group.rb +163 -0
  164. data/spec/gherkin/shared/lexer_group.rb +591 -0
  165. data/spec/gherkin/shared/row_group.rb +125 -0
  166. data/spec/gherkin/shared/tags_group.rb +54 -0
  167. data/spec/gherkin/tag_expression_spec.rb +142 -0
  168. data/spec/spec_helper.rb +75 -0
  169. data/tasks/bench.rake +184 -0
  170. data/tasks/bench/feature_builder.rb +49 -0
  171. data/tasks/bench/null_listener.rb +4 -0
  172. data/tasks/compile.rake +120 -0
  173. data/tasks/cucumber.rake +22 -0
  174. data/tasks/gems.rake +31 -0
  175. data/tasks/ikvm.rake +124 -0
  176. data/tasks/ragel_task.rb +100 -0
  177. data/tasks/release.rake +49 -0
  178. data/tasks/rspec.rake +8 -0
  179. data/tasks/yard.rake +7 -0
  180. data/tasks/yard/default/layout/html/bubble_32x32.png +0 -0
  181. data/tasks/yard/default/layout/html/bubble_48x48.png +0 -0
  182. data/tasks/yard/default/layout/html/footer.erb +5 -0
  183. data/tasks/yard/default/layout/html/index.erb +1 -0
  184. data/tasks/yard/default/layout/html/layout.erb +25 -0
  185. data/tasks/yard/default/layout/html/logo.erb +1 -0
  186. data/tasks/yard/default/layout/html/setup.rb +4 -0
  187. metadata +473 -0
@@ -0,0 +1,8 @@
1
+ Feature: Escaped pipes
2
+ Scenario: They are the future
3
+ Given they have arrived
4
+ | æ | o |
5
+ | a | ø |
6
+ Given they have arrived
7
+ | æ | \|o |
8
+ | \|a | ø\\ |
@@ -0,0 +1,237 @@
1
+ # language: en
2
+ Feature: Gherkin Feature lexer
3
+ In order to make it easy to control the Gherkin syntax
4
+ As a Gherkin developer bent on Gherkin world-domination
5
+ I want a feature lexer that uses a feature parser to
6
+ make all the syntax decisions for me
7
+
8
+ Background:
9
+ Given a "ruby" "root" parser
10
+
11
+ Scenario: Correctly formed feature
12
+ Given the following text is parsed:
13
+ """
14
+ # Apologies to Bill Watterson
15
+ @cardboard_box @wip
16
+ Feature: Transmogrification
17
+ As a young boy with a hyperactive imagination
18
+ I want a cardboard box
19
+ In order to transform the ennui of suburban life into something
20
+ befitting my imagination
21
+
22
+ Background:
23
+ Given I have a transmogrifier
24
+ And I am a member of G.R.O.S.S
25
+
26
+ Scenario: Whoozit to whatzit transmogrification
27
+ Given I have a whoozit
28
+ When I put it in the transmogrifier
29
+ And I press the "transmogrify" button
30
+ Then I should have a whatzit
31
+
32
+ Scenario Outline: Imaginary Beings
33
+ Given I have a <boring being>
34
+ When I transmogrify it with the incantation:
35
+ \"\"\"
36
+ ALAKAZAM!
37
+ \"\"\"
38
+ Then I should have an <exciting being>
39
+
40
+ Examples:
41
+ | boring being | exciting being |
42
+ | Sparrow | Alicanto |
43
+ | Goldfish | Baldanders |
44
+ | Cow | Hsiao |
45
+
46
+ Scenario: Sense of humor detection
47
+ Given the following excerpt:
48
+ \"\"\"
49
+ WOMAN: Who are the Britons?
50
+ ARTHUR: Well, we all are. we're all Britons and I am your king.
51
+ WOMAN: I didn't know we had a king. I thought we were an autonomous
52
+ collective.
53
+ DENNIS: You're fooling yourself. We're living in a dictatorship.
54
+ A self-perpetuating autocracy in which the working classes--
55
+ WOMAN: Oh there you go, bringing class into it again.
56
+ DENNIS: That's what it's all about if only people would--
57
+ ARTHUR: Please, please good people. I am in haste. Who lives
58
+ in that castle?
59
+ \"\"\"
60
+ When I read it
61
+ Then I should be amused
62
+ """
63
+ Then there should be no parse errors
64
+
65
+ Scenario: Keyword before feature
66
+ Given the following text is parsed:
67
+ """
68
+ Scenario: Bullying my way to the head of the line
69
+ Given I am a big bully of a scenario
70
+ Then I should be caught by the syntax police(y)
71
+
72
+ Feature: Too timid to stand up for myself
73
+ """
74
+ Then there should be parse errors on lines 1 through 3
75
+
76
+ Scenario: Multiple Features in file
77
+ Given the following text is parsed:
78
+ """
79
+ Feature:
80
+ Scenario: Hi
81
+ Feature: Uh ohs
82
+ Scenario Outline:
83
+ Feature: This is silly
84
+ """
85
+ Then there should be parse errors on lines 3 and 5
86
+
87
+ Scenario: Tag ends background and scenario
88
+ Given the following text is parsed:
89
+ """
90
+ Feature: test feature
91
+ Background:
92
+ Given a something
93
+ @tag
94
+ And something else
95
+
96
+ @foo
97
+ Scenario: my scenario
98
+ @tag
99
+ Given this is a step
100
+ @oh_hai
101
+ And this is a horrible idea
102
+ Then it shouldn't work
103
+ """
104
+ Then there should be parse errors on lines 5, 10 and 12
105
+
106
+ Scenario: Malformed Tables
107
+ Given the following text is parsed:
108
+ """
109
+ Feature: Antiques Roadshow
110
+ Scenario Outline: Table
111
+ Given a <foo>
112
+ Then a <bar>
113
+
114
+ Examples:
115
+ | foo | bar |
116
+ | 42 | towel |
117
+ @hello
118
+ | 1 | prime |
119
+
120
+ Scenario: Table arguments
121
+ Given this step needs this table:
122
+ | foo | bar |
123
+ | one | two |
124
+ @tag
125
+ | aaa | bbb |
126
+ """
127
+ Then there should be parse errors on lines 10 and 17
128
+
129
+ Scenario: Well-formed Tables
130
+ Given the following text is parsed:
131
+ """
132
+ Feature: Row-by-row
133
+
134
+ Scenario: Tables with comments!
135
+ Given I can now comment out a row:
136
+ | Key | Value |
137
+ # | Yes | No |
138
+ # | Good | Bad |
139
+ | Good | Evil |
140
+ Then I am pleased by these things:
141
+ | Raindrops | Roses |
142
+ # | Whiskers | Kittens |
143
+ | Bright Copper | Kettles |
144
+ # | Warm woolen | Mittens |
145
+ | Also Oban | And Hendricks |
146
+ """
147
+ Then there should be no parse errors
148
+
149
+ Scenario: Multiline keyword descriptions
150
+ Given the following text is parsed:
151
+ """
152
+ Feature: Documentation is fun
153
+ Scenario Outline: With lots of docs
154
+ We need lots of embedded documentation for some reason
155
+ \"\"\" # Not interpreted as a pystring, just plain text
156
+ Oh hai
157
+ \"\"\"
158
+
159
+ La la la
160
+
161
+ Examples:
162
+ | one | two |
163
+ | foo | bar |
164
+
165
+ \"\"\"
166
+ Oh Hello
167
+ \"\"\"
168
+
169
+ # Body of the scenario outline starts below
170
+ Given <something>
171
+ And something <else>
172
+
173
+ # The real examples table
174
+ Examples:
175
+ | something | else |
176
+ | orange | apple |
177
+ """
178
+ Then there should be no parse errors
179
+
180
+ Scenario: Scenario Outline with multiple Example groups
181
+ Given the following text is parsed:
182
+ """
183
+ Feature: Outline Sample
184
+
185
+ Scenario: I have no steps
186
+
187
+ Scenario Outline: Test state
188
+ Given <state> without a table
189
+ Given <other_state> without a table
190
+
191
+ Examples: Rainbow colours
192
+ | state | other_state |
193
+ | missing | passing |
194
+ | passing | passing |
195
+ | failing | passing |
196
+
197
+ Examples: Only passing
198
+ | state | other_state |
199
+ | passing | passing |
200
+ """
201
+ Then there should be no parse errors
202
+
203
+ Scenario: Multiple Scenario Outlines with multiline outline steps
204
+ Given the following text is parsed:
205
+ """
206
+ Feature: Test
207
+ Scenario Outline: with step tables
208
+ Given I have the following fruits in my pantry
209
+ | name | quantity |
210
+ | cucumbers | 10 |
211
+ | strawberrys | 5 |
212
+ | apricots | 7 |
213
+
214
+ When I eat <number> <fruits> from the pantry
215
+ Then I should have <left> <fruits> in the pantry
216
+
217
+ Examples:
218
+ | number | fruits | left |
219
+ | 2 | cucumbers | 8 |
220
+ | 4 | strawberrys | 1 |
221
+ | 2 | apricots | 5 |
222
+
223
+ Scenario Outline: placeholder in a multiline string
224
+ Given my shopping list
225
+ \"\"\"
226
+ Must buy some <fruits>
227
+ \"\"\"
228
+ Then my shopping list should equal
229
+ \"\"\"
230
+ Must buy some cucumbers
231
+ \"\"\"
232
+
233
+ Examples:
234
+ | fruits |
235
+ | cucumbers |
236
+ """
237
+ Then there should be no parse errors
@@ -0,0 +1,498 @@
1
+ Feature: JSON formatter
2
+ In order to support greater access to features
3
+ we want JSON
4
+
5
+ Background:
6
+ Given a JSON formatter
7
+ And a "ruby" "root" parser
8
+
9
+ Scenario: Only a Feature
10
+ Given the following text is parsed:
11
+ """
12
+ # language: no
13
+ # Another comment
14
+ Egenskap: Kjapp
15
+ """
16
+ And the following text is parsed:
17
+ """
18
+ # language: no
19
+ # Yet another comment
20
+ Egenskap: Kjappere
21
+ """
22
+ Then the outputted JSON should be:
23
+ """
24
+ [
25
+ {
26
+ "comments": [
27
+ {
28
+ "line": 1,
29
+ "value": "# language: no"
30
+ },
31
+ {
32
+ "line": 2,
33
+ "value": "# Another comment"
34
+ }
35
+ ],
36
+ "description": "",
37
+ "keyword": "Egenskap",
38
+ "line": 3,
39
+ "name": "Kjapp",
40
+ "uri": "test.feature",
41
+ "id": "kjapp"
42
+ },
43
+ {
44
+ "comments": [
45
+ {
46
+ "line": 1,
47
+ "value": "# language: no"
48
+ },
49
+ {
50
+ "line": 2,
51
+ "value": "# Yet another comment"
52
+ }
53
+ ],
54
+ "description": "",
55
+ "keyword": "Egenskap",
56
+ "line": 3,
57
+ "name": "Kjappere",
58
+ "uri": "test.feature",
59
+ "id": "kjappere"
60
+ }
61
+ ]
62
+ """
63
+
64
+ Scenario: Feature with scenarios and outlines
65
+ Given the following text is parsed:
66
+ """
67
+ @one
68
+ Feature: OH HAI
69
+
70
+ Scenario: Fujin
71
+ Given wind
72
+ Then spirit
73
+
74
+ @two
75
+ Scenario: _why
76
+ Given chunky
77
+ Then bacon
78
+
79
+ @three @four
80
+ Scenario Outline: Life
81
+ Given some <boredom>
82
+
83
+ @five
84
+ Examples: Real life
85
+ |boredom|
86
+ |airport|
87
+ |meeting|
88
+
89
+ Scenario: who stole my mojo?
90
+ When I was
91
+ |asleep|
92
+ And so
93
+ \"\"\"plaintext
94
+ innocent
95
+ \"\"\"
96
+
97
+ # The
98
+ Scenario Outline: with
99
+ # all
100
+ Then nice
101
+
102
+ # comments
103
+ # everywhere
104
+ Examples: An example
105
+ # I mean
106
+ | partout |
107
+ """
108
+ Then the outputted JSON should be:
109
+ """
110
+ [
111
+ {
112
+ "uri": "test.feature",
113
+ "description": "",
114
+ "elements": [
115
+ {
116
+ "description": "",
117
+ "keyword": "Scenario",
118
+ "line": 4,
119
+ "id": "oh-hai;fujin",
120
+ "name": "Fujin",
121
+ "steps": [
122
+ {
123
+ "keyword": "Given ",
124
+ "line": 5,
125
+ "name": "wind"
126
+ },
127
+ {
128
+ "keyword": "Then ",
129
+ "line": 6,
130
+ "name": "spirit"
131
+ }
132
+ ],
133
+ "type": "scenario"
134
+ },
135
+ {
136
+ "description": "",
137
+ "keyword": "Scenario",
138
+ "line": 9,
139
+ "id": "oh-hai;-why",
140
+ "name": "_why",
141
+ "steps": [
142
+ {
143
+ "keyword": "Given ",
144
+ "line": 10,
145
+ "name": "chunky"
146
+ },
147
+ {
148
+ "keyword": "Then ",
149
+ "line": 11,
150
+ "name": "bacon"
151
+ }
152
+ ],
153
+ "tags": [
154
+ {
155
+ "line": 8,
156
+ "name": "@two"
157
+ }
158
+ ],
159
+ "type": "scenario"
160
+ },
161
+ {
162
+ "description": "",
163
+ "examples": [
164
+ {
165
+ "description": "",
166
+ "keyword": "Examples",
167
+ "line": 18,
168
+ "id": "oh-hai;life;real-life",
169
+ "name": "Real life",
170
+ "rows": [
171
+ {
172
+ "id": "oh-hai;life;real-life;1",
173
+ "cells": [
174
+ "boredom"
175
+ ],
176
+ "line": 19
177
+ },
178
+ {
179
+ "id": "oh-hai;life;real-life;2",
180
+ "cells": [
181
+ "airport"
182
+ ],
183
+ "line": 20
184
+ },
185
+ {
186
+ "id": "oh-hai;life;real-life;3",
187
+ "cells": [
188
+ "meeting"
189
+ ],
190
+ "line": 21
191
+ }
192
+ ],
193
+ "tags": [
194
+ {
195
+ "line": 17,
196
+ "name": "@five"
197
+ }
198
+ ]
199
+ }
200
+ ],
201
+ "keyword": "Scenario Outline",
202
+ "line": 14,
203
+ "id": "oh-hai;life",
204
+ "name": "Life",
205
+ "steps": [
206
+ {
207
+ "keyword": "Given ",
208
+ "line": 15,
209
+ "name": "some <boredom>"
210
+ }
211
+ ],
212
+ "tags": [
213
+ {
214
+ "line": 13,
215
+ "name": "@three"
216
+ },
217
+ {
218
+ "line": 13,
219
+ "name": "@four"
220
+ }
221
+ ],
222
+ "type": "scenario_outline"
223
+ },
224
+ {
225
+ "description": "",
226
+ "keyword": "Scenario",
227
+ "line": 23,
228
+ "id": "oh-hai;who-stole-my-mojo?",
229
+ "name": "who stole my mojo?",
230
+ "steps": [
231
+ {
232
+ "keyword": "When ",
233
+ "line": 24,
234
+ "name": "I was",
235
+ "rows": [
236
+ {
237
+ "cells": [
238
+ "asleep"
239
+ ],
240
+ "line": 25
241
+ }
242
+ ]
243
+ },
244
+ {
245
+ "doc_string": {
246
+ "content_type": "plaintext",
247
+ "line": 27,
248
+ "value": "innocent"
249
+ },
250
+ "keyword": "And ",
251
+ "line": 26,
252
+ "name": "so"
253
+ }
254
+ ],
255
+ "type": "scenario"
256
+ },
257
+ {
258
+ "comments": [
259
+ {
260
+ "line": 31,
261
+ "value": "# The"
262
+ }
263
+ ],
264
+ "description": "",
265
+ "examples": [
266
+ {
267
+ "comments": [
268
+ {
269
+ "line": 36,
270
+ "value": "# comments"
271
+ },
272
+ {
273
+ "line": 37,
274
+ "value": "# everywhere"
275
+ }
276
+ ],
277
+ "description": "",
278
+ "keyword": "Examples",
279
+ "line": 38,
280
+ "id": "oh-hai;with;an-example",
281
+ "name": "An example",
282
+ "rows": [
283
+ {
284
+ "id": "oh-hai;with;an-example;1",
285
+ "cells": [
286
+ "partout"
287
+ ],
288
+ "comments": [
289
+ {
290
+ "line": 39,
291
+ "value": "# I mean"
292
+ }
293
+ ],
294
+ "line": 40
295
+ }
296
+ ]
297
+ }
298
+ ],
299
+ "keyword": "Scenario Outline",
300
+ "line": 32,
301
+ "id": "oh-hai;with",
302
+ "name": "with",
303
+ "steps": [
304
+ {
305
+ "comments": [
306
+ {
307
+ "line": 33,
308
+ "value": "# all"
309
+ }
310
+ ],
311
+ "keyword": "Then ",
312
+ "line": 34,
313
+ "name": "nice"
314
+ }
315
+ ],
316
+ "type": "scenario_outline"
317
+ }
318
+ ],
319
+ "keyword": "Feature",
320
+ "line": 2,
321
+ "id": "oh-hai",
322
+ "name": "OH HAI",
323
+ "tags": [
324
+ {
325
+ "line": 1,
326
+ "name": "@one"
327
+ }
328
+ ]
329
+ }
330
+ ]
331
+ """
332
+
333
+ Scenario: Feature with Background
334
+ Given the following text is parsed:
335
+ """
336
+ Feature: Kjapp
337
+
338
+ Background: No idea what Kjapp means
339
+ Given I Google it
340
+
341
+ # Writing JSON by hand sucks
342
+ Scenario:
343
+ Then I think it means "fast"
344
+ """
345
+ Then the outputted JSON should be:
346
+ """
347
+ [
348
+ {
349
+ "uri": "test.feature",
350
+ "keyword": "Feature",
351
+ "name": "Kjapp",
352
+ "id": "kjapp",
353
+ "description": "",
354
+ "line": 1,
355
+ "elements": [
356
+ {
357
+ "type": "background",
358
+ "keyword": "Background",
359
+ "line": 3,
360
+ "name": "No idea what Kjapp means",
361
+ "description": "",
362
+ "steps": [
363
+ {
364
+ "keyword": "Given ",
365
+ "line": 4,
366
+ "name": "I Google it"
367
+ }
368
+ ]
369
+ },
370
+ {
371
+ "type": "scenario",
372
+ "comments": [{"value": "# Writing JSON by hand sucks", "line": 6}],
373
+ "keyword": "Scenario",
374
+ "id": "kjapp;",
375
+ "name": "",
376
+ "description": "",
377
+ "line": 7,
378
+ "steps": [
379
+ {
380
+ "keyword": "Then ",
381
+ "name": "I think it means \"fast\"",
382
+ "line": 8
383
+ }
384
+ ]
385
+ }
386
+ ]
387
+ }
388
+ ]
389
+ """
390
+
391
+ Scenario: Feature with a description
392
+
393
+ We want people to be able to put markdown formatting into their descriptions
394
+ but this means we need to respect whitespace at the start and end of lines
395
+ in the description.
396
+
397
+ Pay close attention to the whitespace in this example.
398
+
399
+ Given the following text is parsed:
400
+ """
401
+ Feature: Foo
402
+ one line
403
+ another line
404
+
405
+ some pre-formatted stuff
406
+
407
+ Background: b name
408
+ test
409
+ test
410
+
411
+ Scenario: s name
412
+ test
413
+ test
414
+
415
+ Scenario Outline: s o name
416
+ test
417
+ test
418
+
419
+ Given <foo>
420
+
421
+ Examples: e name
422
+ test
423
+ test
424
+ | foo |
425
+ | table |
426
+ """
427
+ Then the outputted JSON should be:
428
+ """
429
+ [
430
+ {
431
+ "uri": "test.feature",
432
+ "keyword": "Feature",
433
+ "id": "foo",
434
+ "name": "Foo",
435
+ "description": "one line \nanother line \n\n some pre-formatted stuff",
436
+ "line": 1,
437
+ "elements": [
438
+ {
439
+ "description": " test \n test",
440
+ "keyword": "Background",
441
+ "line": 7,
442
+ "name": "b name",
443
+ "type": "background"
444
+ },
445
+ {
446
+ "description": " test \n test",
447
+ "keyword": "Scenario",
448
+ "line": 11,
449
+ "id": "foo;s-name",
450
+ "name": "s name",
451
+ "type": "scenario"
452
+ },
453
+ {
454
+ "description": " test \n test",
455
+ "examples": [
456
+ {
457
+ "description": " test \n test",
458
+ "keyword": "Examples",
459
+ "line": 21,
460
+ "id": "foo;s-o-name;e-name",
461
+ "name": "e name",
462
+ "rows": [
463
+ {
464
+ "id": "foo;s-o-name;e-name;1",
465
+ "cells": [
466
+ "foo"
467
+ ],
468
+ "line": 24
469
+ },
470
+ {
471
+ "id": "foo;s-o-name;e-name;2",
472
+ "cells": [
473
+ "table"
474
+ ],
475
+ "line": 25
476
+ }
477
+ ]
478
+ }
479
+ ],
480
+ "keyword": "Scenario Outline",
481
+ "line": 15,
482
+ "id": "foo;s-o-name",
483
+ "name": "s o name",
484
+ "steps": [
485
+ {
486
+ "keyword": "Given ",
487
+ "line": 19,
488
+ "name": "<foo>"
489
+ }
490
+ ],
491
+ "type": "scenario_outline"
492
+ }
493
+ ]
494
+ }
495
+ ]
496
+ """
497
+
498
+