gherkin 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (170) hide show
  1. checksums.yaml +4 -4
  2. data/.rsync +5 -0
  3. data/.travis.yml +16 -1
  4. data/Makefile +31 -36
  5. data/berp/CommandLine.dll +0 -0
  6. data/berp/RazorEngine.dll +0 -0
  7. data/berp/RazorEngine.pdb +0 -0
  8. data/berp/System.Web.Razor.dll +0 -0
  9. data/berp/berp.exe +0 -0
  10. data/berp/berp.pdb +0 -0
  11. data/bin/gherkin +34 -0
  12. data/bin/gherkin-generate-tokens +1 -1
  13. data/gherkin-languages.json +3191 -0
  14. data/gherkin.berp +46 -0
  15. data/gherkin.gemspec +6 -6
  16. data/lib/gherkin/gherkin-languages.json +225 -3
  17. data/lib/gherkin/pickles/compiler.rb +31 -31
  18. data/lib/gherkin/stream/gherkin_events.rb +69 -0
  19. data/lib/gherkin/stream/source_events.rb +26 -0
  20. data/lib/gherkin/token_scanner.rb +1 -1
  21. data/testdata/bad/inconsistent_cell_count.feature +14 -0
  22. data/testdata/bad/inconsistent_cell_count.feature.errors.ndjson +2 -0
  23. data/testdata/bad/invalid_language.feature +6 -0
  24. data/testdata/bad/invalid_language.feature.errors.ndjson +1 -0
  25. data/testdata/bad/multiple_parser_errors.feature +9 -0
  26. data/testdata/bad/multiple_parser_errors.feature.errors.ndjson +2 -0
  27. data/testdata/bad/not_gherkin.feature +2 -0
  28. data/testdata/bad/not_gherkin.feature.errors.ndjson +1 -0
  29. data/testdata/bad/single_parser_error.feature +7 -0
  30. data/testdata/bad/single_parser_error.feature.errors.ndjson +1 -0
  31. data/testdata/bad/unexpected_eof.feature +6 -0
  32. data/testdata/bad/unexpected_eof.feature.errors.ndjson +1 -0
  33. data/testdata/good/background.feature +8 -0
  34. data/testdata/good/background.feature.ast.ndjson +1 -0
  35. data/testdata/good/background.feature.pickles.ndjson +1 -0
  36. data/testdata/good/background.feature.source.ndjson +1 -0
  37. data/testdata/good/background.feature.tokens +9 -0
  38. data/testdata/good/datatables.feature +18 -0
  39. data/testdata/good/datatables.feature.ast.ndjson +1 -0
  40. data/testdata/good/datatables.feature.pickles.ndjson +1 -0
  41. data/testdata/good/datatables.feature.source.ndjson +1 -0
  42. data/testdata/good/datatables.feature.tokens +19 -0
  43. data/testdata/good/descriptions.feature +52 -0
  44. data/testdata/good/descriptions.feature.ast.ndjson +1 -0
  45. data/testdata/good/descriptions.feature.pickles.ndjson +8 -0
  46. data/testdata/good/descriptions.feature.source.ndjson +1 -0
  47. data/testdata/good/descriptions.feature.tokens +53 -0
  48. data/testdata/good/docstrings.feature +43 -0
  49. data/testdata/good/docstrings.feature.ast.ndjson +1 -0
  50. data/testdata/good/docstrings.feature.pickles.ndjson +1 -0
  51. data/testdata/good/docstrings.feature.source.ndjson +1 -0
  52. data/testdata/good/docstrings.feature.tokens +44 -0
  53. data/testdata/good/empty.feature +0 -0
  54. data/testdata/good/empty.feature.ast.ndjson +1 -0
  55. data/testdata/good/empty.feature.pickles.ndjson +0 -0
  56. data/testdata/good/empty.feature.source.ndjson +1 -0
  57. data/testdata/good/empty.feature.tokens +1 -0
  58. data/testdata/good/escaped_pipes.feature +11 -0
  59. data/testdata/good/escaped_pipes.feature.ast.ndjson +1 -0
  60. data/testdata/good/escaped_pipes.feature.pickles.ndjson +1 -0
  61. data/testdata/good/escaped_pipes.feature.source.ndjson +1 -0
  62. data/testdata/good/escaped_pipes.feature.tokens +14 -0
  63. data/testdata/good/example_token_multiple.feature +8 -0
  64. data/testdata/good/example_token_multiple.feature.ast.ndjson +1 -0
  65. data/testdata/good/example_token_multiple.feature.pickles.ndjson +1 -0
  66. data/testdata/good/example_token_multiple.feature.source.ndjson +1 -0
  67. data/testdata/good/example_token_multiple.feature.tokens +9 -0
  68. data/testdata/good/example_tokens_everywhere.feature +14 -0
  69. data/testdata/good/example_tokens_everywhere.feature.ast.ndjson +1 -0
  70. data/testdata/good/example_tokens_everywhere.feature.pickles.ndjson +2 -0
  71. data/testdata/good/example_tokens_everywhere.feature.source.ndjson +1 -0
  72. data/testdata/good/example_tokens_everywhere.feature.tokens +15 -0
  73. data/testdata/good/i18n_emoji.feature +5 -0
  74. data/testdata/good/i18n_emoji.feature.ast.ndjson +1 -0
  75. data/testdata/good/i18n_emoji.feature.pickles.ndjson +1 -0
  76. data/testdata/good/i18n_emoji.feature.source.ndjson +1 -0
  77. data/testdata/good/i18n_emoji.feature.tokens +6 -0
  78. data/testdata/good/i18n_fr.feature +63 -0
  79. data/testdata/good/i18n_fr.feature.ast.ndjson +1 -0
  80. data/testdata/good/i18n_fr.feature.pickles.ndjson +11 -0
  81. data/testdata/good/i18n_fr.feature.source.ndjson +1 -0
  82. data/testdata/good/i18n_fr.feature.tokens +64 -0
  83. data/testdata/good/i18n_no.feature +7 -0
  84. data/testdata/good/i18n_no.feature.ast.ndjson +1 -0
  85. data/testdata/good/i18n_no.feature.pickles.ndjson +1 -0
  86. data/testdata/good/i18n_no.feature.source.ndjson +1 -0
  87. data/testdata/good/i18n_no.feature.tokens +8 -0
  88. data/testdata/good/incomplete_background_1.feature +6 -0
  89. data/testdata/good/incomplete_background_1.feature.ast.ndjson +1 -0
  90. data/testdata/good/incomplete_background_1.feature.pickles.ndjson +1 -0
  91. data/testdata/good/incomplete_background_1.feature.source.ndjson +1 -0
  92. data/testdata/good/incomplete_background_1.feature.tokens +7 -0
  93. data/testdata/good/incomplete_background_2.feature +7 -0
  94. data/testdata/good/incomplete_background_2.feature.ast.ndjson +1 -0
  95. data/testdata/good/incomplete_background_2.feature.pickles.ndjson +1 -0
  96. data/testdata/good/incomplete_background_2.feature.source.ndjson +1 -0
  97. data/testdata/good/incomplete_background_2.feature.tokens +8 -0
  98. data/testdata/good/incomplete_feature_1.feature +2 -0
  99. data/testdata/good/incomplete_feature_1.feature.ast.ndjson +1 -0
  100. data/testdata/good/incomplete_feature_1.feature.pickles.ndjson +0 -0
  101. data/testdata/good/incomplete_feature_1.feature.source.ndjson +1 -0
  102. data/testdata/good/incomplete_feature_1.feature.tokens +3 -0
  103. data/testdata/good/incomplete_feature_2.feature +1 -0
  104. data/testdata/good/incomplete_feature_2.feature.ast.ndjson +1 -0
  105. data/testdata/good/incomplete_feature_2.feature.pickles.ndjson +0 -0
  106. data/testdata/good/incomplete_feature_2.feature.source.ndjson +1 -0
  107. data/testdata/good/incomplete_feature_2.feature.tokens +2 -0
  108. data/testdata/good/incomplete_feature_3.feature +1 -0
  109. data/testdata/good/incomplete_feature_3.feature.ast.ndjson +1 -0
  110. data/testdata/good/incomplete_feature_3.feature.pickles.ndjson +0 -0
  111. data/testdata/good/incomplete_feature_3.feature.source.ndjson +1 -0
  112. data/testdata/good/incomplete_feature_3.feature.tokens +2 -0
  113. data/testdata/good/incomplete_scenario.feature +6 -0
  114. data/testdata/good/incomplete_scenario.feature.ast.ndjson +1 -0
  115. data/testdata/good/incomplete_scenario.feature.pickles.ndjson +0 -0
  116. data/testdata/good/incomplete_scenario.feature.source.ndjson +1 -0
  117. data/testdata/good/incomplete_scenario.feature.tokens +7 -0
  118. data/testdata/good/incomplete_scenario_outline.feature +24 -0
  119. data/testdata/good/incomplete_scenario_outline.feature.ast.ndjson +1 -0
  120. data/testdata/good/incomplete_scenario_outline.feature.pickles.ndjson +0 -0
  121. data/testdata/good/incomplete_scenario_outline.feature.source.ndjson +1 -0
  122. data/testdata/good/incomplete_scenario_outline.feature.tokens +25 -0
  123. data/testdata/good/language.feature +6 -0
  124. data/testdata/good/language.feature.ast.ndjson +1 -0
  125. data/testdata/good/language.feature.pickles.ndjson +1 -0
  126. data/testdata/good/language.feature.source.ndjson +1 -0
  127. data/testdata/good/language.feature.tokens +7 -0
  128. data/testdata/good/minimal.feature +4 -0
  129. data/testdata/good/minimal.feature.ast.ndjson +1 -0
  130. data/testdata/good/minimal.feature.pickles.ndjson +1 -0
  131. data/testdata/good/minimal.feature.source.ndjson +1 -0
  132. data/testdata/good/minimal.feature.tokens +5 -0
  133. data/testdata/good/readme_example.feature +18 -0
  134. data/testdata/good/readme_example.feature.ast.ndjson +1 -0
  135. data/testdata/good/readme_example.feature.pickles.ndjson +2 -0
  136. data/testdata/good/readme_example.feature.source.ndjson +1 -0
  137. data/testdata/good/readme_example.feature.tokens +19 -0
  138. data/testdata/good/scenario_outline.feature +8 -0
  139. data/testdata/good/scenario_outline.feature.ast.ndjson +1 -0
  140. data/testdata/good/scenario_outline.feature.pickles.ndjson +1 -0
  141. data/testdata/good/scenario_outline.feature.source.ndjson +1 -0
  142. data/testdata/good/scenario_outline.feature.tokens +9 -0
  143. data/testdata/good/scenario_outline_no_newline.feature +8 -0
  144. data/testdata/good/scenario_outline_no_newline.feature.ast.ndjson +1 -0
  145. data/testdata/good/scenario_outline_no_newline.feature.pickles.ndjson +1 -0
  146. data/testdata/good/scenario_outline_no_newline.feature.source.ndjson +1 -0
  147. data/testdata/good/scenario_outline_no_newline.feature.tokens +9 -0
  148. data/testdata/good/scenario_outlines_with_tags.feature +18 -0
  149. data/testdata/good/scenario_outlines_with_tags.feature.ast.ndjson +1 -0
  150. data/testdata/good/scenario_outlines_with_tags.feature.pickles.ndjson +2 -0
  151. data/testdata/good/scenario_outlines_with_tags.feature.source.ndjson +1 -0
  152. data/testdata/good/scenario_outlines_with_tags.feature.tokens +19 -0
  153. data/testdata/good/several_examples.feature +17 -0
  154. data/testdata/good/several_examples.feature.ast.ndjson +1 -0
  155. data/testdata/good/several_examples.feature.pickles.ndjson +2 -0
  156. data/testdata/good/several_examples.feature.source.ndjson +1 -0
  157. data/testdata/good/several_examples.feature.tokens +18 -0
  158. data/testdata/good/spaces_in_language.feature +2 -0
  159. data/testdata/good/spaces_in_language.feature.ast.ndjson +1 -0
  160. data/testdata/good/spaces_in_language.feature.pickles.ndjson +0 -0
  161. data/testdata/good/spaces_in_language.feature.source.ndjson +1 -0
  162. data/testdata/good/spaces_in_language.feature.tokens +3 -0
  163. data/testdata/good/tags.feature +25 -0
  164. data/testdata/good/tags.feature.ast.ndjson +1 -0
  165. data/testdata/good/tags.feature.pickles.ndjson +3 -0
  166. data/testdata/good/tags.feature.source.ndjson +1 -0
  167. data/testdata/good/tags.feature.tokens +26 -0
  168. metadata +176 -25
  169. data/bin/gherkin-generate-ast +0 -22
  170. data/bin/gherkin-generate-pickles +0 -26
@@ -0,0 +1,46 @@
1
+ [
2
+ Tokens -> #Empty,#Comment,#TagLine,#FeatureLine,#BackgroundLine,#ScenarioLine,#ScenarioOutlineLine,#ExamplesLine,#StepLine,#DocStringSeparator,#TableRow,#Language
3
+ IgnoredTokens -> #Comment,#Empty
4
+ ClassName -> Parser
5
+ Namespace -> Gherkin
6
+ ]
7
+
8
+ GherkinDocument! := Feature?
9
+ Feature! := Feature_Header Background? Scenario_Definition*
10
+ Feature_Header! := #Language? Tags? #FeatureLine Feature_Description
11
+
12
+ Background! := #BackgroundLine Background_Description Scenario_Step*
13
+
14
+ // we could avoid defining Scenario_Definition, but that would require regular look-aheads, so worse performance
15
+ Scenario_Definition! := Tags? (Scenario | ScenarioOutline)
16
+
17
+ Scenario! := #ScenarioLine Scenario_Description Scenario_Step*
18
+
19
+ ScenarioOutline! := #ScenarioOutlineLine ScenarioOutline_Description ScenarioOutline_Step* Examples_Definition*
20
+ // after the first "Examples" block, interpreting a tag line is ambiguous (tagline of next examples or of next scenario)
21
+ // because of this, we need a lookahead hint, that connects the tag line to the next examples, if there is an examples block ahead
22
+ Examples_Definition! [#Empty|#Comment|#TagLine->#ExamplesLine]:= Tags? Examples
23
+ Examples! := #ExamplesLine Examples_Description Examples_Table?
24
+ Examples_Table! := #TableRow #TableRow*
25
+
26
+ Scenario_Step := Step
27
+ ScenarioOutline_Step := Step
28
+
29
+ Step! := #StepLine Step_Arg?
30
+ Step_Arg := (DataTable | DocString)
31
+
32
+ DataTable! := #TableRow+
33
+ DocString! := #DocStringSeparator #Other* #DocStringSeparator
34
+
35
+ Tags! := #TagLine+
36
+
37
+ Feature_Description := Description_Helper
38
+ Background_Description := Description_Helper
39
+ Scenario_Description := Description_Helper
40
+ ScenarioOutline_Description := Description_Helper
41
+ Examples_Description := Description_Helper
42
+
43
+ // we need to explicitly mention comment, to avoid merging it into the description line's #Other token
44
+ // we also eat the leading empty lines, the tailing lines are not removed by the parser to avoid lookahead, this has to be done by the AST builder
45
+ Description_Helper := #Empty* Description? #Comment*
46
+ Description! := #Other+
@@ -1,22 +1,22 @@
1
1
  # encoding: utf-8
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'gherkin'
4
- s.version = '4.0.0'
4
+ s.version = '4.1.0'
5
5
  s.authors = ["Gáspár Nagy", "Aslak Hellesøy", "Steve Tooke"]
6
6
  s.description = 'Gherkin parser'
7
7
  s.summary = "gherkin-#{s.version}"
8
8
  s.email = 'cukes@googlegroups.com'
9
- s.homepage = "https://github.com/cucumber/gherkin"
9
+ s.homepage = "https://github.com/cucumber/gherkin-ruby"
10
10
  s.platform = Gem::Platform::RUBY
11
11
  s.license = "MIT"
12
12
  s.required_ruby_version = ">= 1.9.3"
13
13
 
14
- s.add_development_dependency 'bundler', '~> 1.7'
15
- s.add_development_dependency 'rake', '~> 10.4'
16
- s.add_development_dependency 'rspec', '~> 3.3'
14
+ s.add_development_dependency 'bundler'
15
+ s.add_development_dependency 'rake', '~> 10.5'
16
+ s.add_development_dependency 'rspec', '~> 3.5'
17
17
 
18
18
  # For coverage reports
19
- s.add_development_dependency 'coveralls', '~> 0.8', '< 0.8.8'
19
+ s.add_development_dependency 'coveralls'
20
20
 
21
21
  s.rubygems_version = ">= 1.6.1"
22
22
  s.files = `git ls-files`.split("\n").reject {|path| path =~ /\.gitignore$/ }
@@ -122,6 +122,93 @@
122
122
  "عندما "
123
123
  ]
124
124
  },
125
+ "ast": {
126
+ "and": [
127
+ "* ",
128
+ "Y ",
129
+ "Ya "
130
+ ],
131
+ "background": [
132
+ "Antecedentes"
133
+ ],
134
+ "but": [
135
+ "* ",
136
+ "Peru "
137
+ ],
138
+ "examples": [
139
+ "Exemplos"
140
+ ],
141
+ "feature": [
142
+ "Carauterística"
143
+ ],
144
+ "given": [
145
+ "* ",
146
+ "Dáu ",
147
+ "Dada ",
148
+ "Daos ",
149
+ "Daes "
150
+ ],
151
+ "name": "Asturian",
152
+ "native": "asturianu",
153
+ "scenario": [
154
+ "Casu"
155
+ ],
156
+ "scenarioOutline": [
157
+ "Esbozu del casu"
158
+ ],
159
+ "then": [
160
+ "* ",
161
+ "Entós "
162
+ ],
163
+ "when": [
164
+ "* ",
165
+ "Cuando "
166
+ ]
167
+ },
168
+ "az": {
169
+ "and": [
170
+ "* ",
171
+ "Və ",
172
+ "Həm "
173
+ ],
174
+ "background": [
175
+ "Keçmiş",
176
+ "Kontekst"
177
+ ],
178
+ "but": [
179
+ "* ",
180
+ "Amma ",
181
+ "Ancaq "
182
+ ],
183
+ "examples": [
184
+ "Nümunələr"
185
+ ],
186
+ "feature": [
187
+ "Özəllik"
188
+ ],
189
+ "given": [
190
+ "* ",
191
+ "Tutaq ki ",
192
+ "Verilir "
193
+ ],
194
+ "name": "Azerbaijani",
195
+ "native": "Azərbaycanca",
196
+ "scenario": [
197
+ "Ssenari"
198
+ ],
199
+ "scenarioOutline": [
200
+ "Ssenarinin strukturu"
201
+ ],
202
+ "then": [
203
+ "* ",
204
+ "O halda "
205
+ ],
206
+ "when": [
207
+ "* ",
208
+ "Əgər ",
209
+ "Nə vaxt ki "
210
+ ]
211
+ },
125
212
  "bg": {
126
213
  "and": [
127
214
  "* ",
@@ -1625,6 +1712,45 @@
1625
1712
  "Menawa "
1626
1713
  ]
1627
1714
  },
1715
+ "ka": {
1716
+ "and": [
1717
+ "* ",
1718
+ "და"
1719
+ ],
1720
+ "background": [
1721
+ "კონტექსტი"
1722
+ ],
1723
+ "but": [
1724
+ "* ",
1725
+ "მაგ­რამ"
1726
+ ],
1727
+ "examples": [
1728
+ "მაგალითები"
1729
+ ],
1730
+ "feature": [
1731
+ "თვისება"
1732
+ ],
1733
+ "given": [
1734
+ "* ",
1735
+ "მოცემული"
1736
+ ],
1737
+ "name": "Georgian",
1738
+ "native": "ქართველი",
1739
+ "scenario": [
1740
+ "სცენარის"
1741
+ ],
1742
+ "scenarioOutline": [
1743
+ "სცენარის ნიმუში"
1744
+ ],
1745
+ "then": [
1746
+ "* ",
1747
+ "მაშინ"
1748
+ ],
1749
+ "when": [
1750
+ "* ",
1751
+ "როდესაც"
1752
+ ]
1753
+ },
1628
1754
  "kn": {
1629
1755
  "and": [
1630
1756
  "* ",
@@ -1830,6 +1956,100 @@
1830
1956
  "Ja "
1831
1957
  ]
1832
1958
  },
1959
+ "mk-Cyrl": {
1960
+ "and": [
1961
+ "* ",
1962
+ "И "
1963
+ ],
1964
+ "background": [
1965
+ "Контекст",
1966
+ "Содржина"
1967
+ ],
1968
+ "but": [
1969
+ "* ",
1970
+ "Но "
1971
+ ],
1972
+ "examples": [
1973
+ "Примери",
1974
+ "Сценарија"
1975
+ ],
1976
+ "feature": [
1977
+ "Функционалност",
1978
+ "Бизнис потреба",
1979
+ "Можност"
1980
+ ],
1981
+ "given": [
1982
+ "* ",
1983
+ "Дадено ",
1984
+ "Дадена "
1985
+ ],
1986
+ "name": "Macedonian",
1987
+ "native": "Македонски",
1988
+ "scenario": [
1989
+ "Сценарио",
1990
+ "На пример"
1991
+ ],
1992
+ "scenarioOutline": [
1993
+ "Преглед на сценарија",
1994
+ "Скица",
1995
+ "Концепт"
1996
+ ],
1997
+ "then": [
1998
+ "* ",
1999
+ "Тогаш "
2000
+ ],
2001
+ "when": [
2002
+ "* ",
2003
+ "Кога "
2004
+ ]
2005
+ },
2006
+ "mk-Latn": {
2007
+ "and": [
2008
+ "* ",
2009
+ "I "
2010
+ ],
2011
+ "background": [
2012
+ "Kontekst",
2013
+ "Sodrzhina"
2014
+ ],
2015
+ "but": [
2016
+ "* ",
2017
+ "No "
2018
+ ],
2019
+ "examples": [
2020
+ "Primeri",
2021
+ "Scenaria"
2022
+ ],
2023
+ "feature": [
2024
+ "Funkcionalnost",
2025
+ "Biznis potreba",
2026
+ "Mozhnost"
2027
+ ],
2028
+ "given": [
2029
+ "* ",
2030
+ "Dadeno ",
2031
+ "Dadena "
2032
+ ],
2033
+ "name": "Macedonian (Latin)",
2034
+ "native": "Makedonski (Latinica)",
2035
+ "scenario": [
2036
+ "Scenario",
2037
+ "Na primer"
2038
+ ],
2039
+ "scenarioOutline": [
2040
+ "Pregled na scenarija",
2041
+ "Skica",
2042
+ "Koncept"
2043
+ ],
2044
+ "then": [
2045
+ "* ",
2046
+ "Togash "
2047
+ ],
2048
+ "when": [
2049
+ "* ",
2050
+ "Koga "
2051
+ ]
2052
+ },
1833
2053
  "mn": {
1834
2054
  "and": [
1835
2055
  "* ",
@@ -1911,7 +2131,8 @@
1911
2131
  ],
1912
2132
  "when": [
1913
2133
  "* ",
1914
- "Als "
2134
+ "Als ",
2135
+ "Wanneer "
1915
2136
  ]
1916
2137
  },
1917
2138
  "no": {
@@ -2177,7 +2398,8 @@
2177
2398
  "* ",
2178
2399
  "Допустим ",
2179
2400
  "Дано ",
2180
- "Пусть "
2401
+ "Пусть ",
2402
+ "Если "
2181
2403
  ],
2182
2404
  "name": "Russian",
2183
2405
  "native": "русский",
@@ -2190,11 +2412,11 @@
2190
2412
  "then": [
2191
2413
  "* ",
2192
2414
  "То ",
2415
+ "Затем ",
2193
2416
  "Тогда "
2194
2417
  ],
2195
2418
  "when": [
2196
2419
  "* ",
2197
- "Если ",
2198
2420
  "Когда "
2199
2421
  ]
2200
2422
  },
@@ -1,7 +1,7 @@
1
1
  module Gherkin
2
2
  module Pickles
3
3
  class Compiler
4
- def compile(gherkin_document, path)
4
+ def compile(gherkin_document)
5
5
  pickles = []
6
6
 
7
7
  return pickles unless gherkin_document[:feature]
@@ -11,11 +11,11 @@ module Gherkin
11
11
 
12
12
  feature[:children].each do |scenario_definition|
13
13
  if(scenario_definition[:type] == :Background)
14
- background_steps = pickle_steps(scenario_definition, path)
14
+ background_steps = pickle_steps(scenario_definition)
15
15
  elsif(scenario_definition[:type] == :Scenario)
16
- compile_scenario(feature_tags, background_steps, scenario_definition, path, pickles)
16
+ compile_scenario(feature_tags, background_steps, scenario_definition, feature[:language], pickles)
17
17
  else
18
- compile_scenario_outline(feature_tags, background_steps, scenario_definition, path, pickles)
18
+ compile_scenario_outline(feature_tags, background_steps, scenario_definition, feature[:language], pickles)
19
19
  end
20
20
  end
21
21
  return pickles
@@ -23,7 +23,7 @@ module Gherkin
23
23
 
24
24
  private
25
25
 
26
- def compile_scenario(feature_tags, background_steps, scenario, path, pickles)
26
+ def compile_scenario(feature_tags, background_steps, scenario, language, pickles)
27
27
  return if scenario[:steps].empty?
28
28
 
29
29
  steps = [].concat(background_steps)
@@ -31,19 +31,20 @@ module Gherkin
31
31
  tags = [].concat(feature_tags).concat(scenario[:tags])
32
32
 
33
33
  scenario[:steps].each do |step|
34
- steps.push(pickle_step(step, path))
34
+ steps.push(pickle_step(step))
35
35
  end
36
36
 
37
37
  pickle = {
38
- tags: pickle_tags(tags, path),
38
+ tags: pickle_tags(tags),
39
39
  name: scenario[:name],
40
- locations: [pickle_location(scenario[:location], path)],
40
+ language: language,
41
+ locations: [pickle_location(scenario[:location])],
41
42
  steps: steps
42
43
  }
43
44
  pickles.push(pickle)
44
45
  end
45
46
 
46
- def compile_scenario_outline(feature_tags, background_steps, scenario_outline, path, pickles)
47
+ def compile_scenario_outline(feature_tags, background_steps, scenario_outline, language, pickles)
47
48
  return if scenario_outline[:steps].empty?
48
49
 
49
50
  scenario_outline[:examples].reject { |examples| examples[:tableHeader].nil? }.each do |examples|
@@ -55,13 +56,13 @@ module Gherkin
55
56
 
56
57
  scenario_outline[:steps].each do |scenario_outline_step|
57
58
  step_text = interpolate(scenario_outline_step[:text], variable_cells, value_cells);
58
- arguments = create_pickle_arguments(scenario_outline_step[:argument], variable_cells, value_cells, path)
59
+ arguments = create_pickle_arguments(scenario_outline_step[:argument], variable_cells, value_cells)
59
60
  pickle_step = {
60
61
  text: step_text,
61
62
  arguments: arguments,
62
63
  locations: [
63
- pickle_location(values[:location], path),
64
- pickle_step_location(scenario_outline_step, path)
64
+ pickle_location(values[:location]),
65
+ pickle_step_location(scenario_outline_step)
65
66
  ]
66
67
  }
67
68
  steps.push(pickle_step)
@@ -69,11 +70,12 @@ module Gherkin
69
70
 
70
71
  pickle = {
71
72
  name: interpolate(scenario_outline[:name], variable_cells, value_cells),
73
+ language: language,
72
74
  steps: steps,
73
- tags: pickle_tags(tags, path),
75
+ tags: pickle_tags(tags),
74
76
  locations: [
75
- pickle_location(values[:location], path),
76
- pickle_location(scenario_outline[:location], path)
77
+ pickle_location(values[:location]),
78
+ pickle_location(scenario_outline[:location])
77
79
  ]
78
80
  }
79
81
  pickles.push(pickle);
@@ -82,7 +84,7 @@ module Gherkin
82
84
  end
83
85
  end
84
86
 
85
- def create_pickle_arguments(argument, variable_cells, value_cells, path)
87
+ def create_pickle_arguments(argument, variable_cells, value_cells)
86
88
  result = []
87
89
  return result if argument.nil?
88
90
  if (argument[:type] == :DataTable)
@@ -91,7 +93,7 @@ module Gherkin
91
93
  {
92
94
  cells: row[:cells].map do |cell|
93
95
  {
94
- location: pickle_location(cell[:location], path),
96
+ location: pickle_location(cell[:location]),
95
97
  value: interpolate(cell[:value], variable_cells, value_cells)
96
98
  }
97
99
  end
@@ -101,7 +103,7 @@ module Gherkin
101
103
  result.push(table)
102
104
  elsif (argument[:type] == :DocString)
103
105
  doc_string = {
104
- location: pickle_location(argument[:location], path),
106
+ location: pickle_location(argument[:location]),
105
107
  content: interpolate(argument[:content], variable_cells, value_cells)
106
108
  }
107
109
  result.push(doc_string)
@@ -119,44 +121,42 @@ module Gherkin
119
121
  name
120
122
  end
121
123
 
122
- def pickle_steps(scenario_definition, path)
124
+ def pickle_steps(scenario_definition)
123
125
  scenario_definition[:steps].map do |step|
124
- pickle_step(step, path)
126
+ pickle_step(step)
125
127
  end
126
128
  end
127
129
 
128
- def pickle_step(step, path)
130
+ def pickle_step(step)
129
131
  {
130
132
  text: step[:text],
131
- arguments: create_pickle_arguments(step[:argument], [], [], path),
132
- locations: [pickle_step_location(step, path)]
133
+ arguments: create_pickle_arguments(step[:argument], [], []),
134
+ locations: [pickle_step_location(step)]
133
135
  }
134
136
  end
135
137
 
136
- def pickle_step_location(step, path)
138
+ def pickle_step_location(step)
137
139
  {
138
- path: path,
139
140
  line: step[:location][:line],
140
141
  column: step[:location][:column] + (step[:keyword] ? step[:keyword].length : 0)
141
142
  }
142
143
  end
143
144
 
144
- def pickle_location(location, path)
145
+ def pickle_location(location)
145
146
  {
146
- path: path,
147
147
  line: location[:line],
148
148
  column: location[:column]
149
149
  }
150
150
  end
151
151
 
152
- def pickle_tags(tags, path)
153
- tags.map {|tag| pickle_tag(tag, path)}
152
+ def pickle_tags(tags)
153
+ tags.map {|tag| pickle_tag(tag)}
154
154
  end
155
155
 
156
- def pickle_tag(tag, path)
156
+ def pickle_tag(tag)
157
157
  {
158
158
  name: tag[:name],
159
- location: pickle_location(tag[:location], path)
159
+ location: pickle_location(tag[:location])
160
160
  }
161
161
  end
162
162
  end