gherkin 2.0.2-java → 2.1.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +12 -0
- data/LICENSE +1 -1
- data/README.rdoc +2 -2
- data/Rakefile +2 -2
- data/VERSION.yml +2 -2
- data/features/json_formatter.feature +3 -41
- data/features/step_definitions/gherkin_steps.rb +5 -6
- data/features/step_definitions/json_formatter_steps.rb +3 -2
- data/features/step_definitions/json_lexer_steps.rb +5 -5
- data/features/step_definitions/pretty_formatter_steps.rb +9 -13
- data/features/support/env.rb +1 -1
- data/lib/gherkin/formatter/argument.rb +1 -0
- data/lib/gherkin/formatter/filter_formatter.rb +149 -0
- data/lib/gherkin/formatter/json_formatter.rb +35 -45
- data/lib/gherkin/formatter/line_filter.rb +26 -0
- data/lib/gherkin/formatter/model.rb +85 -0
- data/lib/gherkin/formatter/pretty_formatter.rb +36 -39
- data/lib/gherkin/formatter/regexp_filter.rb +17 -0
- data/lib/gherkin/formatter/tag_count_formatter.rb +44 -0
- data/lib/gherkin/i18n.rb +5 -5
- data/lib/gherkin/i18n.yml +13 -0
- data/lib/gherkin/i18n_lexer.rb +2 -2
- data/lib/gherkin/{json_lexer.rb → json_parser.rb} +17 -5
- data/lib/gherkin/{parser → listener}/event.rb +1 -1
- data/lib/gherkin/{parser → listener}/formatter_listener.rb +30 -23
- data/lib/gherkin/native/java.rb +9 -1
- data/lib/gherkin/parser/parser.rb +27 -14
- data/lib/gherkin/rubify.rb +5 -1
- data/lib/gherkin/tag_expression.rb +62 -0
- data/lib/gherkin/tools/files.rb +3 -4
- data/lib/gherkin/tools/reformat.rb +2 -2
- data/lib/gherkin/tools/stats.rb +3 -4
- data/lib/gherkin/tools/stats_listener.rb +1 -1
- data/ragel/lexer.c.rl.erb +2 -3
- data/ragel/lexer.java.rl.erb +1 -2
- data/ragel/lexer.rb.rl.erb +1 -2
- data/spec/gherkin/fixtures/complex_for_filtering.feature +60 -0
- data/spec/gherkin/fixtures/complex_with_tags.feature +61 -0
- data/spec/gherkin/fixtures/hantu_pisang.feature +35 -0
- data/spec/gherkin/formatter/filter_formatter_spec.rb +156 -0
- data/spec/gherkin/formatter/model_spec.rb +15 -0
- data/spec/gherkin/formatter/pretty_formatter_spec.rb +17 -16
- data/spec/gherkin/formatter/tag_count_formatter_spec.rb +31 -0
- data/spec/gherkin/i18n_lexer_spec.rb +3 -3
- data/spec/gherkin/i18n_spec.rb +2 -4
- data/spec/gherkin/{json_lexer_spec.rb → json_parser_spec.rb} +13 -8
- data/spec/gherkin/sexp_recorder.rb +10 -4
- data/spec/gherkin/shared/lexer_group.rb +0 -40
- data/spec/gherkin/shared/py_string_group.rb +0 -1
- data/spec/gherkin/shared/row_group.rb +1 -2
- data/spec/gherkin/tag_expression_spec.rb +137 -0
- data/spec/spec_helper.rb +5 -1
- data/tasks/bench.rake +5 -9
- metadata +29 -24
- data/lib/gherkin/parser/filter_listener.rb +0 -203
- data/lib/gherkin/parser/row.rb +0 -15
- data/lib/gherkin/parser/tag_expression.rb +0 -50
- data/spec/gherkin/parser/filter_listener_spec.rb +0 -397
- data/spec/gherkin/parser/formatter_listener_spec.rb +0 -134
- data/spec/gherkin/parser/parser_spec.rb +0 -50
- data/spec/gherkin/parser/tag_expression_spec.rb +0 -116
@@ -8,14 +8,14 @@ module Gherkin
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should store the i18n language of the last scanned feature" do
|
11
|
-
@lexer.scan("# language: fr\n"
|
11
|
+
@lexer.scan("# language: fr\n")
|
12
12
|
@lexer.i18n_language.iso_code.should == "fr"
|
13
|
-
@lexer.scan("# language: no\n"
|
13
|
+
@lexer.scan("# language: no\n")
|
14
14
|
@lexer.i18n_language.iso_code.should == "no"
|
15
15
|
end
|
16
16
|
|
17
17
|
it "should use English i18n by default" do
|
18
|
-
@lexer.scan("Feature: foo\n"
|
18
|
+
@lexer.scan("Feature: foo\n")
|
19
19
|
@lexer.i18n_language.iso_code.should == "en"
|
20
20
|
end
|
21
21
|
|
data/spec/gherkin/i18n_spec.rb
CHANGED
@@ -9,14 +9,13 @@ module Gherkin
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def scan_file(lexer, file)
|
12
|
-
lexer.scan(File.new(File.dirname(__FILE__) + "/fixtures/" + file).read
|
12
|
+
lexer.scan(File.new(File.dirname(__FILE__) + "/fixtures/" + file).read)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should recognize keywords in the language of the lexer" do
|
16
16
|
lexer = Gherkin::I18nLexer.new(@listener, false)
|
17
17
|
scan_file(lexer, "i18n_no.feature")
|
18
18
|
@listener.to_sexp.should == [
|
19
|
-
[:location, "i18n_no.feature", 0],
|
20
19
|
[:comment, "#language:no", 1],
|
21
20
|
[:feature, "Egenskap", "i18n support", "", 2],
|
22
21
|
[:scenario, "Scenario", "Parsing many languages", "", 4],
|
@@ -31,7 +30,6 @@ module Gherkin
|
|
31
30
|
lexer = Gherkin::I18nLexer.new(@listener, false)
|
32
31
|
scan_file(lexer, "i18n_zh-CN.feature")
|
33
32
|
@listener.to_sexp.should == [
|
34
|
-
[:location, "i18n_zh-CN.feature", 0],
|
35
33
|
[:comment, "#language:zh-CN", 1],
|
36
34
|
[:feature, "功能", "加法", "", 2],
|
37
35
|
[:scenario, "场景", "两个数相加", "", 4],
|
@@ -47,7 +45,6 @@ module Gherkin
|
|
47
45
|
lexer = Gherkin::I18nLexer.new(@listener, false)
|
48
46
|
scan_file(lexer, "i18n_fr.feature")
|
49
47
|
@listener.to_sexp.should == [
|
50
|
-
[:location, "i18n_fr.feature", 0],
|
51
48
|
[:comment, "#language:fr", 1],
|
52
49
|
[:feature, "Fonctionnalité", "Addition", "", 2],
|
53
50
|
[:scenario_outline, "Plan du scénario", "Addition de produits dérivés", "", 3],
|
@@ -89,6 +86,7 @@ module Gherkin
|
|
89
86
|
| en-Scouse | Scouse | Scouse |
|
90
87
|
| en-au | Australian | Australian |
|
91
88
|
| en-lol | LOLCAT | LOLCAT |
|
89
|
+
| en-pirate | Pirate | Pirate |
|
92
90
|
| en-tx | Texan | Texan |
|
93
91
|
| eo | Esperanto | Esperanto |
|
94
92
|
| es | Spanish | español |
|
@@ -1,19 +1,20 @@
|
|
1
1
|
#encoding: utf-8
|
2
2
|
require 'spec_helper'
|
3
|
-
require 'gherkin/
|
3
|
+
require 'gherkin/json_parser'
|
4
4
|
|
5
5
|
module Gherkin
|
6
|
-
describe
|
6
|
+
describe JSONParser do
|
7
7
|
|
8
8
|
before do
|
9
9
|
@listener = Gherkin::SexpRecorder.new
|
10
|
-
@
|
10
|
+
@parser = Gherkin::JSONParser.new(nil)
|
11
11
|
end
|
12
12
|
|
13
13
|
describe "An empty feature" do
|
14
14
|
it "should scan empty features" do
|
15
|
-
@
|
15
|
+
@parser.parse_with_listener('{}', @listener)
|
16
16
|
@listener.to_sexp.should == [
|
17
|
+
[:location, "unknown.json"],
|
17
18
|
[:eof]
|
18
19
|
]
|
19
20
|
end
|
@@ -21,8 +22,9 @@ module Gherkin
|
|
21
22
|
|
22
23
|
describe "A barely empty feature" do
|
23
24
|
it "should scan a feature with no elements" do
|
24
|
-
@
|
25
|
+
@parser.parse_with_listener('{ "keyword": "Feature", "name": "One", "description": "", "line" : 3 }', @listener)
|
25
26
|
@listener.to_sexp.should == [
|
27
|
+
[:location, "unknown.json"],
|
26
28
|
[:feature, "Feature", "One", "", 3],
|
27
29
|
[:eof]
|
28
30
|
]
|
@@ -31,8 +33,9 @@ module Gherkin
|
|
31
33
|
|
32
34
|
describe "Missing line numbers" do
|
33
35
|
it "should indicate a line number of 0 if a line attribute doesn't exist" do
|
34
|
-
@
|
36
|
+
@parser.parse_with_listener('{ "name": "My Sweet Featur", "keyword": "Feature", "description": "" }', @listener)
|
35
37
|
@listener.to_sexp.should == [
|
38
|
+
[:location, "unknown.json"],
|
36
39
|
[:feature, "Feature", "My Sweet Featur", "", 0],
|
37
40
|
[:eof]
|
38
41
|
]
|
@@ -41,8 +44,9 @@ module Gherkin
|
|
41
44
|
|
42
45
|
describe "Keywords" do
|
43
46
|
it "should use the keyword from the source when provided" do
|
44
|
-
@
|
47
|
+
@parser.parse_with_listener('{ "name" : "My Sweet Featur", "language": "fr", "keyword": "Feature", "description": "" }', @listener)
|
45
48
|
@listener.to_sexp.should == [
|
49
|
+
[:location, "unknown.json"],
|
46
50
|
[:feature, "Feature", "My Sweet Featur", "", 0],
|
47
51
|
[:eof]
|
48
52
|
]
|
@@ -51,8 +55,9 @@ module Gherkin
|
|
51
55
|
|
52
56
|
describe "A complex feature with tags, comments, multiple scenarios, and multiple steps and tables" do
|
53
57
|
it "should find things in the right order" do
|
54
|
-
|
58
|
+
@parser.parse_with_listener(fixture("complex.json"), @listener)
|
55
59
|
@listener.to_sexp.should == [
|
60
|
+
[:location, "unknown.json"],
|
56
61
|
[:tag, "@tag1", 0],
|
57
62
|
[:tag, "@tag2", 0],
|
58
63
|
[:feature, "Feature", "Feature Text","In order to test multiline forms", 0],
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'gherkin/rubify'
|
2
|
-
require 'gherkin/
|
2
|
+
require 'gherkin/formatter/model'
|
3
3
|
|
4
4
|
module Gherkin
|
5
5
|
class SexpRecorder
|
@@ -38,12 +38,18 @@ module Gherkin
|
|
38
38
|
def sexpify(o)
|
39
39
|
if (defined?(JRUBY_VERSION) && Java.java.util.Collection === o) || Array === o
|
40
40
|
o.map{|e| sexpify(e)}
|
41
|
-
elsif(
|
41
|
+
elsif(Formatter::Model::Row === o)
|
42
42
|
{
|
43
|
-
"cells" =>
|
44
|
-
"comments" =>
|
43
|
+
"cells" => sexpify(o.cells),
|
44
|
+
"comments" => sexpify(o.comments),
|
45
45
|
"line" => o.line,
|
46
46
|
}
|
47
|
+
elsif(Formatter::Model::Comment === o)
|
48
|
+
o.value
|
49
|
+
elsif(Formatter::Model::Tag === o)
|
50
|
+
o.name
|
51
|
+
elsif(Formatter::Model::Statement === o)
|
52
|
+
"APE"
|
47
53
|
else
|
48
54
|
o
|
49
55
|
end
|
@@ -12,7 +12,6 @@ module Gherkin
|
|
12
12
|
it "should parse a one line comment" do
|
13
13
|
scan("# My comment\n")
|
14
14
|
@listener.to_sexp.should == [
|
15
|
-
[:location, 'test.feature', 0],
|
16
15
|
[:comment, "# My comment", 1],
|
17
16
|
[:eof]
|
18
17
|
]
|
@@ -21,7 +20,6 @@ module Gherkin
|
|
21
20
|
it "should parse a multiline comment" do
|
22
21
|
scan("# Hello\n\n# World\n")
|
23
22
|
@listener.to_sexp.should == [
|
24
|
-
[:location, 'test.feature', 0],
|
25
23
|
[:comment, "# Hello", 1],
|
26
24
|
[:comment, "# World", 3],
|
27
25
|
[:eof]
|
@@ -31,7 +29,6 @@ module Gherkin
|
|
31
29
|
it "should not consume comments as part of a multiline name" do
|
32
30
|
scan("Scenario: test\n#hello\n Scenario: another")
|
33
31
|
@listener.to_sexp.should == [
|
34
|
-
[:location, 'test.feature', 0],
|
35
32
|
[:scenario, "Scenario", "test", "", 1],
|
36
33
|
[:comment, "#hello", 2],
|
37
34
|
[:scenario, "Scenario", "another", "", 3],
|
@@ -42,7 +39,6 @@ module Gherkin
|
|
42
39
|
it "should not consume comments as part of a multiline example name" do
|
43
40
|
scan("Examples: thing\n# ho hum\n| 1 | 2 |\n| 3 | 4 |\n")
|
44
41
|
@listener.to_sexp.should == [
|
45
|
-
[:location, 'test.feature', 0],
|
46
42
|
[:examples, "Examples", "thing", "", 1],
|
47
43
|
[:comment, "# ho hum", 2],
|
48
44
|
[:row, ["1","2"], 3],
|
@@ -54,7 +50,6 @@ module Gherkin
|
|
54
50
|
it "should allow empty comment lines" do
|
55
51
|
scan("#\n # A comment\n #\n")
|
56
52
|
@listener.to_sexp.should == [
|
57
|
-
[:location, 'test.feature', 0],
|
58
53
|
[:comment, "#", 1],
|
59
54
|
[:comment, "# A comment", 2],
|
60
55
|
[:comment, "#", 3],
|
@@ -73,7 +68,6 @@ module Gherkin
|
|
73
68
|
it "should not take the tags as part of a multiline name feature element" do
|
74
69
|
scan("Feature: hi\n Scenario: test\n\n@hello\n Scenario: another")
|
75
70
|
@listener.to_sexp.should == [
|
76
|
-
[:location, 'test.feature', 0],
|
77
71
|
[:feature, "Feature", "hi", "", 1],
|
78
72
|
[:scenario, "Scenario", "test", "", 2],
|
79
73
|
[:tag, "@hello", 4],
|
@@ -87,7 +81,6 @@ module Gherkin
|
|
87
81
|
it "should allow an empty background name and description" do
|
88
82
|
scan("Background:\nGiven I am a step\n")
|
89
83
|
@listener.to_sexp.should == [
|
90
|
-
[:location, 'test.feature', 0],
|
91
84
|
[:background, "Background", "", "", 1],
|
92
85
|
[:step, "Given ", "I am a step", 2],
|
93
86
|
[:eof]
|
@@ -97,7 +90,6 @@ module Gherkin
|
|
97
90
|
it "should allow an empty background description" do
|
98
91
|
scan("Background: Yeah\nGiven I am a step\n")
|
99
92
|
@listener.to_sexp.should == [
|
100
|
-
[:location, 'test.feature', 0],
|
101
93
|
[:background, "Background", "Yeah", "", 1],
|
102
94
|
[:step, "Given ", "I am a step", 2],
|
103
95
|
[:eof]
|
@@ -107,7 +99,6 @@ module Gherkin
|
|
107
99
|
it "should allow multiline names ending at eof" do
|
108
100
|
scan("Background: I have several\n Lines to look at\n None starting with Given")
|
109
101
|
@listener.to_sexp.should == [
|
110
|
-
[:location, 'test.feature', 0],
|
111
102
|
[:background, "Background", "I have several", "Lines to look at\nNone starting with Given", 1],
|
112
103
|
[:eof]
|
113
104
|
]
|
@@ -121,7 +112,6 @@ Background: It is my ambition to say
|
|
121
112
|
in a whole book.
|
122
113
|
Given I am a step})
|
123
114
|
@listener.to_sexp.should == [
|
124
|
-
[:location, 'test.feature', 0],
|
125
115
|
[:feature, "Feature", "Hi", "", 1],
|
126
116
|
[:background, "Background", "It is my ambition to say", "in ten sentences\nwhat others say\nin a whole book.",2],
|
127
117
|
[:step, "Given ", "I am a step", 6],
|
@@ -134,7 +124,6 @@ Given I am a step})
|
|
134
124
|
it "should be parsed" do
|
135
125
|
scan("Scenario: Hello\n")
|
136
126
|
@listener.to_sexp.should == [
|
137
|
-
[:location, 'test.feature', 0],
|
138
127
|
[:scenario, "Scenario", "Hello", "", 1],
|
139
128
|
[:eof]
|
140
129
|
]
|
@@ -146,7 +135,6 @@ Given I am a step})
|
|
146
135
|
Given baz
|
147
136
|
})
|
148
137
|
@listener.to_sexp.should == [
|
149
|
-
[:location, 'test.feature', 0],
|
150
138
|
[:scenario, "Scenario", "bar", "", 1],
|
151
139
|
[:step, "Given ", "baz", 3],
|
152
140
|
[:eof]
|
@@ -161,7 +149,6 @@ Given I am a step})
|
|
161
149
|
Given I am a step
|
162
150
|
})
|
163
151
|
@listener.to_sexp.should == [
|
164
|
-
[:location, 'test.feature', 0],
|
165
152
|
[:scenario, "Scenario", "It is my ambition to say", "in ten sentences\nwhat others say\nin a whole book.", 1],
|
166
153
|
[:step, "Given ", "I am a step", 5],
|
167
154
|
[:eof]
|
@@ -171,7 +158,6 @@ Given I am a step})
|
|
171
158
|
it "should allow multiline names ending at eof" do
|
172
159
|
scan("Scenario: I have several\n Lines to look at\n None starting with Given")
|
173
160
|
@listener.to_sexp.should == [
|
174
|
-
[:location, 'test.feature', 0],
|
175
161
|
[:scenario, "Scenario", "I have several", "Lines to look at\nNone starting with Given", 1],
|
176
162
|
[:eof]
|
177
163
|
]
|
@@ -184,7 +170,6 @@ Given I am a step})
|
|
184
170
|
But I might not because I am a Charles Dickens character
|
185
171
|
})
|
186
172
|
@listener.to_sexp.should == [
|
187
|
-
[:location, 'test.feature', 0],
|
188
173
|
[:scenario, "Scenario", "I have a Button", "Buttons are great", 1],
|
189
174
|
[:step, "Given ", "I have some", 3],
|
190
175
|
[:step, "But ", "I might not because I am a Charles Dickens character", 4],
|
@@ -198,7 +183,6 @@ Given I am a step})
|
|
198
183
|
Given I am a step
|
199
184
|
})
|
200
185
|
@listener.to_sexp.should == [
|
201
|
-
[:location, 'test.feature', 0],
|
202
186
|
[:scenario, "Scenario", "When I have when in scenario", "I should be fine", 1],
|
203
187
|
[:step, "Given ", "I am a step", 3],
|
204
188
|
[:eof]
|
@@ -217,7 +201,6 @@ Given I am a step
|
|
217
201
|
|green|
|
218
202
|
})
|
219
203
|
@listener.to_sexp.should == [
|
220
|
-
[:location, 'test.feature', 0],
|
221
204
|
[:scenario_outline, "Scenario Outline", "Hello", "With a description", 1],
|
222
205
|
[:step, "Given ", "a <what> cucumber", 3],
|
223
206
|
[:examples, "Examples", "With a name", "and a description", 4],
|
@@ -234,7 +217,6 @@ Given I am a step
|
|
234
217
|
Scenario: My Scenario
|
235
218
|
})
|
236
219
|
@listener.to_sexp.should == [
|
237
|
-
[:location, 'test.feature', 0],
|
238
220
|
[:scenario_outline, "Scenario Outline", "Hello", "", 1],
|
239
221
|
[:scenario, "Scenario", "My Scenario", "", 3],
|
240
222
|
[:eof]
|
@@ -250,7 +232,6 @@ Given I am a step
|
|
250
232
|
|
251
233
|
})
|
252
234
|
@listener.to_sexp.should == [
|
253
|
-
[:location, 'test.feature', 0],
|
254
235
|
[:scenario_outline, "Scenario Outline", "It is my ambition to say", "in ten sentences\nwhat others say\nin a whole book.", 1],
|
255
236
|
[:step, "Given ", "I am a step", 5],
|
256
237
|
[:eof]
|
@@ -265,7 +246,6 @@ Given I am a step
|
|
265
246
|
|5|6|
|
266
247
|
})
|
267
248
|
@listener.to_sexp.should == [
|
268
|
-
[:location, 'test.feature', 0],
|
269
249
|
[:examples, "Examples", "", "", 1],
|
270
250
|
[:row, ["x","y"], 2],
|
271
251
|
[:row, ["5","6"], 3],
|
@@ -281,7 +261,6 @@ Given I am a step
|
|
281
261
|
|5|
|
282
262
|
})
|
283
263
|
@listener.to_sexp.should == [
|
284
|
-
[:location, 'test.feature', 0],
|
285
264
|
[:examples, "Examples", "I'm a multiline name", "and I'm ok\nf'real", 1],
|
286
265
|
[:row, ["x"], 4],
|
287
266
|
[:row, ["5"], 5],
|
@@ -296,7 +275,6 @@ Given I am a step
|
|
296
275
|
|a|b|
|
297
276
|
})
|
298
277
|
@listener.to_sexp.should == [
|
299
|
-
[:location, 'test.feature', 0],
|
300
278
|
[:step, "Given ", "I have a table", 1],
|
301
279
|
[:row, ['a','b'], 2],
|
302
280
|
[:eof]
|
@@ -306,7 +284,6 @@ Given I am a step
|
|
306
284
|
it "should parse steps with inline py_string" do
|
307
285
|
scan("Given I have a string\n\"\"\"\nhello\nworld\n\"\"\"")
|
308
286
|
@listener.to_sexp.should == [
|
309
|
-
[:location, 'test.feature', 0],
|
310
287
|
[:step, "Given ", "I have a string", 1],
|
311
288
|
[:py_string, "hello\nworld", 2],
|
312
289
|
[:eof]
|
@@ -318,7 +295,6 @@ Given I am a step
|
|
318
295
|
it "should find the feature, scenario, and step" do
|
319
296
|
scan("Feature: Feature Text\n Scenario: Reading a Scenario\n Given there is a step\n")
|
320
297
|
@listener.to_sexp.should == [
|
321
|
-
[:location, 'test.feature', 0],
|
322
298
|
[:feature, "Feature", "Feature Text", "", 1],
|
323
299
|
[:scenario, "Scenario", "Reading a Scenario", "", 2],
|
324
300
|
[:step, "Given ", "there is a step", 3],
|
@@ -331,7 +307,6 @@ Given I am a step
|
|
331
307
|
it "should not raise an error when whitespace follows the Feature, Scenario, and Steps" do
|
332
308
|
scan("Feature: Feature Text\n Scenario: Reading a Scenario\n Given there is a step\n ")
|
333
309
|
@listener.to_sexp.should == [
|
334
|
-
[:location, 'test.feature', 0],
|
335
310
|
[:feature, "Feature", "Feature Text", "", 1],
|
336
311
|
[:scenario, "Scenario", "Reading a Scenario", "", 2],
|
337
312
|
[:step, "Given ", "there is a step", 3],
|
@@ -345,7 +320,6 @@ Given I am a step
|
|
345
320
|
it "should find the feature, scenario, and three steps" do
|
346
321
|
scan("Feature: Feature Text\n Scenario: Reading a Scenario\n Given there is a step\n And another step\n And a third step\n")
|
347
322
|
@listener.to_sexp.should == [
|
348
|
-
[:location, 'test.feature', 0],
|
349
323
|
[:feature, "Feature", "Feature Text", "", 1],
|
350
324
|
[:scenario, "Scenario", "Reading a Scenario", "", 2],
|
351
325
|
[:step, "Given ", "there is a step", 3],
|
@@ -360,7 +334,6 @@ Given I am a step
|
|
360
334
|
it "should find the feature" do
|
361
335
|
scan("Feature: Feature Text\n")
|
362
336
|
@listener.to_sexp.should == [
|
363
|
-
[:location, 'test.feature', 0],
|
364
337
|
[:feature, "Feature", "Feature Text", "", 1],
|
365
338
|
[:eof]
|
366
339
|
]
|
@@ -369,7 +342,6 @@ Given I am a step
|
|
369
342
|
it "should parse a one line feature with no newline" do
|
370
343
|
scan("Feature: hi")
|
371
344
|
@listener.to_sexp.should == [
|
372
|
-
[:location, 'test.feature', 0],
|
373
345
|
[:feature, "Feature", "hi", "", 1],
|
374
346
|
[:eof]
|
375
347
|
]
|
@@ -380,7 +352,6 @@ Given I am a step
|
|
380
352
|
it "should find the feature" do
|
381
353
|
scan("Feature: Feature Text\n And some more text")
|
382
354
|
@listener.to_sexp.should == [
|
383
|
-
[:location, 'test.feature', 0],
|
384
355
|
[:feature, "Feature", "Feature Text", "And some more text", 1],
|
385
356
|
[:eof]
|
386
357
|
]
|
@@ -391,7 +362,6 @@ Given I am a step
|
|
391
362
|
it "should find the feature and scenario" do
|
392
363
|
scan("Feature: Feature Text\nScenario: Reading a Scenario\n")
|
393
364
|
@listener.to_sexp.should == [
|
394
|
-
[:location, 'test.feature', 0],
|
395
365
|
[:feature, "Feature", "Feature Text", "", 1],
|
396
366
|
[:scenario, "Scenario", "Reading a Scenario", "", 2],
|
397
367
|
[:eof]
|
@@ -403,7 +373,6 @@ Given I am a step
|
|
403
373
|
it "should find the feature and two scenarios" do
|
404
374
|
scan("Feature: Feature Text\nScenario: Reading a Scenario\n Given a step\n\nScenario: A second scenario\n Given another step\n")
|
405
375
|
@listener.to_sexp.should == [
|
406
|
-
[:location, 'test.feature', 0],
|
407
376
|
[:feature, "Feature", "Feature Text", "", 1],
|
408
377
|
[:scenario, "Scenario", "Reading a Scenario", "", 2],
|
409
378
|
[:step, "Given ", "a step", 3],
|
@@ -416,7 +385,6 @@ Given I am a step
|
|
416
385
|
it "should find the feature and two scenarios without indentation" do
|
417
386
|
scan("Feature: Feature Text\nScenario: Reading a Scenario\nGiven a step\nScenario: A second scenario\nGiven another step\n")
|
418
387
|
@listener.to_sexp.should == [
|
419
|
-
[:location, 'test.feature', 0],
|
420
388
|
[:feature, "Feature", "Feature Text", "", 1],
|
421
389
|
[:scenario, "Scenario", "Reading a Scenario", "", 2],
|
422
390
|
[:step, "Given ", "a step", 3],
|
@@ -431,7 +399,6 @@ Given I am a step
|
|
431
399
|
it "should find the feature, scenarios, steps, and comments in the proper order" do
|
432
400
|
scan_file("simple_with_comments.feature")
|
433
401
|
@listener.to_sexp.should == [
|
434
|
-
[:location, 'simple_with_comments.feature', 0],
|
435
402
|
[:comment, "# Here is a comment", 1],
|
436
403
|
[:feature, "Feature", "Feature Text", "", 2],
|
437
404
|
[:comment, "# Here is another # comment", 3],
|
@@ -446,7 +413,6 @@ Given I am a step
|
|
446
413
|
it "should support comments in tables" do
|
447
414
|
scan_file("comments_in_table.feature")
|
448
415
|
@listener.to_sexp.should == [
|
449
|
-
[:location, 'comments_in_table.feature', 0],
|
450
416
|
[:feature, "Feature", "x", "", 1],
|
451
417
|
[:scenario_outline, "Scenario Outline", "x", "", 3],
|
452
418
|
[:step, "Then ", "x is <state>", 4],
|
@@ -463,7 +429,6 @@ Given I am a step
|
|
463
429
|
it "should find the feature, scenario, step, and tags in the proper order" do
|
464
430
|
scan_file("simple_with_tags.feature")
|
465
431
|
@listener.to_sexp.should == [
|
466
|
-
[:location, 'simple_with_tags.feature', 0],
|
467
432
|
[:comment, "# FC", 1],
|
468
433
|
[:tag, "@ft",2],
|
469
434
|
[:feature, "Feature", "hi", "", 3],
|
@@ -485,7 +450,6 @@ Given I am a step
|
|
485
450
|
it "should lex this feature properly" do
|
486
451
|
scan_file("1.feature")
|
487
452
|
@listener.to_sexp.should == [
|
488
|
-
[:location, '1.feature', 0],
|
489
453
|
[:feature, "Feature", "Logging in", "So that I can be myself", 1],
|
490
454
|
[:comment, "# Comment", 3],
|
491
455
|
[:scenario, "Scenario", "Anonymous user can get a login form.", "Scenery here", 4],
|
@@ -500,7 +464,6 @@ Given I am a step
|
|
500
464
|
it "should find things in the right order" do
|
501
465
|
scan_file("complex.feature")
|
502
466
|
@listener.to_sexp.should == [
|
503
|
-
[:location, 'complex.feature', 0],
|
504
467
|
[:comment, "#Comment on line 1", 1],
|
505
468
|
[:comment, "#Comment on line 2", 2],
|
506
469
|
[:tag, "@tag1", 3],
|
@@ -544,7 +507,6 @@ Given I am a step
|
|
544
507
|
it "should find things in the right order for CRLF features" do
|
545
508
|
scan_file("dos_line_endings.feature")
|
546
509
|
@listener.to_sexp.should == [
|
547
|
-
[:location, 'dos_line_endings.feature', 0],
|
548
510
|
[:comment, "#Comment on line 1", 1],
|
549
511
|
[:comment, "#Comment on line 2", 2],
|
550
512
|
[:tag, "@tag1", 3],
|
@@ -586,7 +548,6 @@ Given I am a step
|
|
586
548
|
it "should cope with the retarded BOM that many Windows editors insert at the beginning of a file" do
|
587
549
|
scan_file("with_bom.feature")
|
588
550
|
@listener.to_sexp.should == [
|
589
|
-
[:location, 'with_bom.feature', 0],
|
590
551
|
[:feature, "Feature", "Feature Text", "", 1],
|
591
552
|
[:scenario, "Scenario", "Reading a Scenario", "", 2],
|
592
553
|
[:step, "Given ", "there is a step", 3],
|
@@ -613,7 +574,6 @@ Given I am a step
|
|
613
574
|
it "Feature keyword should terminate narratives for multiline capable tokens" do
|
614
575
|
scan("Feature:\nBackground:\nFeature:\nScenario Outline:\nFeature:\nScenario:\nFeature:\nExamples:\nFeature:\n")
|
615
576
|
@listener.to_sexp.should == [
|
616
|
-
[:location, 'test.feature', 0],
|
617
577
|
[:feature, "Feature", "", "", 1],
|
618
578
|
[:background, "Background", "", "", 2],
|
619
579
|
[:feature, "Feature", "", "", 3],
|