gherkin 1.0.30-universal-dotnet
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitattributes +2 -0
- data/.gitignore +9 -0
- data/.mailmap +2 -0
- data/History.txt +187 -0
- data/LICENSE +20 -0
- data/README.rdoc +59 -0
- data/Rakefile +58 -0
- data/VERSION.yml +5 -0
- data/bin/gherkin +5 -0
- data/cucumber.yml +3 -0
- data/features/escaped_pipes.feature +8 -0
- data/features/feature_parser.feature +226 -0
- data/features/native_lexer.feature +19 -0
- data/features/parser_with_native_lexer.feature +205 -0
- data/features/pretty_printer.feature +14 -0
- data/features/step_definitions/eyeball_steps.rb +3 -0
- data/features/step_definitions/gherkin_steps.rb +30 -0
- data/features/step_definitions/pretty_formatter_steps.rb +55 -0
- data/features/steps_parser.feature +46 -0
- data/features/support/env.rb +33 -0
- data/ikvm/.gitignore +3 -0
- data/java/.gitignore +2 -0
- data/java/src/main/java/gherkin/lexer/.gitignore +1 -0
- data/java/src/main/resources/gherkin/.gitignore +1 -0
- data/lib/.gitignore +4 -0
- data/lib/gherkin.rb +2 -0
- data/lib/gherkin/c_lexer.rb +17 -0
- data/lib/gherkin/cli/main.rb +33 -0
- data/lib/gherkin/formatter/argument.rb +27 -0
- data/lib/gherkin/formatter/colors.rb +119 -0
- data/lib/gherkin/formatter/escaping.rb +15 -0
- data/lib/gherkin/formatter/monochrome_format.rb +9 -0
- data/lib/gherkin/formatter/pretty_formatter.rb +168 -0
- data/lib/gherkin/i18n.rb +176 -0
- data/lib/gherkin/i18n.yml +588 -0
- data/lib/gherkin/i18n_lexer.rb +38 -0
- data/lib/gherkin/native.rb +7 -0
- data/lib/gherkin/native/ikvm.rb +55 -0
- data/lib/gherkin/native/java.rb +47 -0
- data/lib/gherkin/native/null.rb +9 -0
- data/lib/gherkin/parser/event.rb +45 -0
- data/lib/gherkin/parser/filter_listener.rb +199 -0
- data/lib/gherkin/parser/meta.txt +5 -0
- data/lib/gherkin/parser/parser.rb +142 -0
- data/lib/gherkin/parser/root.txt +11 -0
- data/lib/gherkin/parser/steps.txt +4 -0
- data/lib/gherkin/parser/tag_expression.rb +50 -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 +18 -0
- data/lib/gherkin/tools.rb +8 -0
- data/lib/gherkin/tools/files.rb +35 -0
- data/lib/gherkin/tools/reformat.rb +19 -0
- data/lib/gherkin/tools/stats.rb +21 -0
- data/lib/gherkin/tools/stats_listener.rb +57 -0
- data/ragel/i18n/.gitignore +1 -0
- data/ragel/lexer.c.rl.erb +425 -0
- data/ragel/lexer.java.rl.erb +216 -0
- data/ragel/lexer.rb.rl.erb +173 -0
- data/ragel/lexer_common.rl.erb +50 -0
- data/spec/gherkin/c_lexer_spec.rb +21 -0
- data/spec/gherkin/csharp_lexer_spec.rb +20 -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/dos_line_endings.feature +45 -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/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/argument_spec.rb +28 -0
- data/spec/gherkin/formatter/colors_spec.rb +19 -0
- data/spec/gherkin/formatter/pretty_formatter_spec.rb +162 -0
- data/spec/gherkin/formatter/spaces.feature +9 -0
- data/spec/gherkin/formatter/tabs.feature +9 -0
- data/spec/gherkin/i18n_lexer_spec.rb +26 -0
- data/spec/gherkin/i18n_spec.rb +144 -0
- data/spec/gherkin/java_lexer_spec.rb +21 -0
- data/spec/gherkin/parser/filter_listener_spec.rb +390 -0
- data/spec/gherkin/parser/parser_spec.rb +50 -0
- data/spec/gherkin/parser/tag_expression_spec.rb +116 -0
- data/spec/gherkin/rb_lexer_spec.rb +19 -0
- data/spec/gherkin/sexp_recorder.rb +32 -0
- data/spec/gherkin/shared/lexer_spec.rb +550 -0
- data/spec/gherkin/shared/py_string_spec.rb +150 -0
- data/spec/gherkin/shared/row_spec.rb +104 -0
- data/spec/gherkin/shared/tags_spec.rb +50 -0
- data/spec/spec_helper.rb +87 -0
- data/tasks/bench.rake +188 -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 +89 -0
- data/tasks/cucumber.rake +26 -0
- data/tasks/gems.rake +45 -0
- data/tasks/ikvm.rake +47 -0
- data/tasks/ragel_task.rb +70 -0
- data/tasks/rdoc.rake +12 -0
- data/tasks/release.rake +26 -0
- data/tasks/rspec.rake +15 -0
- metadata +257 -0
@@ -0,0 +1,144 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
3
|
+
|
4
|
+
module Gherkin
|
5
|
+
module Lexer
|
6
|
+
describe I18n do
|
7
|
+
before do
|
8
|
+
@listener = Gherkin::SexpRecorder.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def scan_file(lexer, file)
|
12
|
+
lexer.scan(File.new(File.dirname(__FILE__) + "/fixtures/" + file).read)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should recognize keywords in the language of the lexer" do
|
16
|
+
lexer = Gherkin::I18nLexer.new(@listener, false)
|
17
|
+
scan_file(lexer, "i18n_no.feature")
|
18
|
+
@listener.to_sexp.should == [
|
19
|
+
[:comment, "#language:no", 1],
|
20
|
+
[:feature, "Egenskap", "i18n support", 2],
|
21
|
+
[:scenario, "Scenario", "Parsing many languages", 4],
|
22
|
+
[:step, "Gitt ", "Gherkin supports many languages", 5],
|
23
|
+
[:step, "Når ", "Norwegian keywords are parsed", 6],
|
24
|
+
[:step, "Så ", "they should be recognized", 7],
|
25
|
+
[:eof]
|
26
|
+
]
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should parse languages without a space after keywords" do
|
30
|
+
lexer = Gherkin::I18nLexer.new(@listener, false)
|
31
|
+
scan_file(lexer, "i18n_zh-CN.feature")
|
32
|
+
@listener.to_sexp.should == [
|
33
|
+
[:comment, "#language:zh-CN", 1],
|
34
|
+
[:feature, "功能", "加法", 2],
|
35
|
+
[:scenario, "场景", "两个数相加", 4],
|
36
|
+
[:step, "假如", "我已经在计算器里输入6", 5],
|
37
|
+
[:step, "而且", "我已经在计算器里输入7", 6],
|
38
|
+
[:step, "当", "我按相加按钮", 7],
|
39
|
+
[:step, "那么", "我应该在屏幕上看到的结果是13", 8],
|
40
|
+
[:eof]
|
41
|
+
]
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should parse languages with spaces after some keywords but not others" do
|
45
|
+
lexer = Gherkin::I18nLexer.new(@listener, false)
|
46
|
+
scan_file(lexer, "i18n_fr.feature")
|
47
|
+
@listener.to_sexp.should == [
|
48
|
+
[:comment, "#language:fr", 1],
|
49
|
+
[:feature, "Fonctionnalité", "Addition", 2],
|
50
|
+
[:scenario_outline, "Plan du scénario", "Addition de produits dérivés", 3],
|
51
|
+
[:step, "Soit ", "une calculatrice", 4],
|
52
|
+
[:step, "Etant donné ", "qu'on tape <a>", 5],
|
53
|
+
[:step, "Et ", "qu'on tape <b>", 6],
|
54
|
+
[:step, "Lorsqu'", "on tape additionner", 7],
|
55
|
+
[:step, "Alors ", "le résultat doit être <somme>", 8],
|
56
|
+
[:examples, "Exemples", "", 10],
|
57
|
+
[:row, %w{a b somme}, 11],
|
58
|
+
[:row, %w{2 2 4}, 12],
|
59
|
+
[:row, %w{2 3 5}, 13],
|
60
|
+
[:eof]
|
61
|
+
]
|
62
|
+
end
|
63
|
+
|
64
|
+
describe 'keywords' do
|
65
|
+
it "should have code keywords without space, comma or apostrophe" do
|
66
|
+
['Akkor', 'Etantdonné', 'Lorsque', '假設'].each do |code_keyword|
|
67
|
+
Gherkin::I18n.code_keywords.should include(code_keyword)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
unless defined?(JRUBY_VERSION)
|
72
|
+
it "should print available languages" do
|
73
|
+
("\n" + Gherkin::I18n.language_table).should == %{
|
74
|
+
| ar | Arabic | العربية |
|
75
|
+
| bg | Bulgarian | български |
|
76
|
+
| ca | Catalan | català |
|
77
|
+
| cs | Czech | Česky |
|
78
|
+
| cy-GB | Welsh | Cymraeg |
|
79
|
+
| da | Danish | dansk |
|
80
|
+
| de | German | Deutsch |
|
81
|
+
| en | English | English |
|
82
|
+
| en-Scouse | Scouse | Scouse |
|
83
|
+
| en-au | Australian | Australian |
|
84
|
+
| en-lol | LOLCAT | LOLCAT |
|
85
|
+
| en-tx | Texan | Texan |
|
86
|
+
| eo | Esperanto | Esperanto |
|
87
|
+
| es | Spanish | español |
|
88
|
+
| et | Estonian | eesti keel |
|
89
|
+
| fi | Finnish | suomi |
|
90
|
+
| fr | French | français |
|
91
|
+
| he | Hebrew | עברית |
|
92
|
+
| hr | Croatian | hrvatski |
|
93
|
+
| hu | Hungarian | magyar |
|
94
|
+
| id | Indonesian | Bahasa Indonesia |
|
95
|
+
| it | Italian | italiano |
|
96
|
+
| ja | Japanese | 日本語 |
|
97
|
+
| ko | Korean | 한국어 |
|
98
|
+
| lt | Lithuanian | lietuvių kalba |
|
99
|
+
| lu | Luxemburgish | Lëtzebuergesch |
|
100
|
+
| lv | Latvian | latviešu |
|
101
|
+
| nl | Dutch | Nederlands |
|
102
|
+
| no | Norwegian | norsk |
|
103
|
+
| pl | Polish | polski |
|
104
|
+
| pt | Portuguese | português |
|
105
|
+
| ro | Romanian | română |
|
106
|
+
| ro-RO | Romanian (diacritical) | română (diacritical) |
|
107
|
+
| ru | Russian | русский |
|
108
|
+
| sk | Slovak | Slovensky |
|
109
|
+
| sr-Cyrl | Serbian | Српски |
|
110
|
+
| sr-Latn | Serbian (Latin) | Srpski (Latinica) |
|
111
|
+
| sv | Swedish | Svenska |
|
112
|
+
| tr | Turkish | Türkçe |
|
113
|
+
| uk | Ukrainian | Українська |
|
114
|
+
| uz | Uzbek | Узбекча |
|
115
|
+
| vi | Vietnamese | Tiếng Việt |
|
116
|
+
| zh-CN | Chinese simplified | 简体中文 |
|
117
|
+
| zh-TW | Chinese traditional | 繁體中文 |
|
118
|
+
}
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should print keywords for a given language" do
|
123
|
+
("\n" + Gherkin::I18n.get('fr').keyword_table).should == %{
|
124
|
+
| feature | "Fonctionnalité" |
|
125
|
+
| background | "Contexte" |
|
126
|
+
| scenario | "Scénario" |
|
127
|
+
| scenario_outline | "Plan du scénario", "Plan du Scénario" |
|
128
|
+
| examples | "Exemples" |
|
129
|
+
| given | "* ", "Soit ", "Etant donné " |
|
130
|
+
| when | "* ", "Quand ", "Lorsque ", "Lorsqu'" |
|
131
|
+
| then | "* ", "Alors " |
|
132
|
+
| and | "* ", "Et " |
|
133
|
+
| but | "* ", "Mais " |
|
134
|
+
| given (code) | "Soit", "Etantdonné" |
|
135
|
+
| when (code) | "Quand", "Lorsque", "Lorsqu" |
|
136
|
+
| then (code) | "Alors" |
|
137
|
+
| and (code) | "Et" |
|
138
|
+
| but (code) | "Mais" |
|
139
|
+
}
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#encoding: utf-8
|
2
|
+
if defined?(JRUBY_VERSION)
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
4
|
+
require 'gherkin.jar'
|
5
|
+
|
6
|
+
module Gherkin
|
7
|
+
module JavaLexer
|
8
|
+
describe "Java Lexer" do
|
9
|
+
before do
|
10
|
+
@listener = Gherkin::SexpRecorder.new
|
11
|
+
@lexer = Java::Gherkin::I18nLexer.new(@listener)
|
12
|
+
end
|
13
|
+
|
14
|
+
it_should_behave_like "a Gherkin lexer"
|
15
|
+
it_should_behave_like "a Gherkin lexer lexing tags"
|
16
|
+
it_should_behave_like "a Gherkin lexer lexing py_strings"
|
17
|
+
it_should_behave_like "a Gherkin lexer lexing rows"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,390 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
3
|
+
require 'gherkin/parser/filter_listener'
|
4
|
+
require 'gherkin/formatter/pretty_formatter'
|
5
|
+
require 'stringio'
|
6
|
+
|
7
|
+
module Gherkin
|
8
|
+
module Parser
|
9
|
+
describe FilterListener do
|
10
|
+
|
11
|
+
class LineListener
|
12
|
+
attr_reader :lines
|
13
|
+
|
14
|
+
def method_missing(*sexp_args)
|
15
|
+
@lines ||= []
|
16
|
+
@lines << sexp_args[-1]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def verify_filters(expected_lines, filters)
|
21
|
+
line_listener = LineListener.new
|
22
|
+
scan(line_listener, filters)
|
23
|
+
line_listener.lines.should == expected_lines
|
24
|
+
end
|
25
|
+
|
26
|
+
def verify_output(expected_output, filters)
|
27
|
+
io = StringIO.new
|
28
|
+
scan(Gherkin::Formatter::PrettyFormatter.new(io, true), filters)
|
29
|
+
io.rewind
|
30
|
+
io.read.should == expected_output
|
31
|
+
end
|
32
|
+
|
33
|
+
def scan(listener, filters)
|
34
|
+
filter_listener = FilterListener.new(listener, filters)
|
35
|
+
parser = Gherkin::Parser::Parser.new(filter_listener, true, "root")
|
36
|
+
lexer = Gherkin::I18nLexer.new(parser, true)
|
37
|
+
lexer.scan(@input)
|
38
|
+
end
|
39
|
+
|
40
|
+
context "Scenario" do
|
41
|
+
before do
|
42
|
+
@input = %{Feature: 1
|
43
|
+
Scenario: 2
|
44
|
+
Given 3
|
45
|
+
|
46
|
+
Scenario: 5
|
47
|
+
Given 6
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should not replay anything if no lines match" do
|
52
|
+
verify_filters([:eof], [90])
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should not replay anything if no names match" do
|
56
|
+
verify_filters([:eof], [/pudding/])
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should replay identically when there is no filter" do
|
60
|
+
verify_filters([1,2,3,5,6,:eof], [])
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should replay identically when line filter is feature line" do
|
64
|
+
verify_filters([1,2,3,5,6,:eof], [1])
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should match scenario line of first scenario" do
|
68
|
+
verify_filters([1,2,3,:eof], [2])
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should match name of first scenario" do
|
72
|
+
verify_filters([1,2,3,:eof], [/2/])
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should match step line of first scenario" do
|
76
|
+
verify_filters([1,2,3,:eof], [3])
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should match step line of second scenario" do
|
80
|
+
verify_filters([1,5,6,:eof], [6])
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should replay identically (except newlines) when the filter matches both scenarios" do
|
84
|
+
verify_filters([1,2,3,5,6,:eof], [3,6])
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
context "Scenario with py_string" do
|
89
|
+
before do
|
90
|
+
@input = %{Feature: 1
|
91
|
+
Scenario: 2
|
92
|
+
Given 3
|
93
|
+
"""
|
94
|
+
5
|
95
|
+
"""
|
96
|
+
|
97
|
+
Scenario: 8
|
98
|
+
Given 9
|
99
|
+
}
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should replay identically when there is no filter" do
|
103
|
+
verify_filters([1,2,3,4,8,9,:eof], {})
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should filter on py_string line" do
|
107
|
+
verify_filters([1,2,3,4,:eof], [4])
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
context "Scenario with Table and Comment and Tag" do
|
112
|
+
before do
|
113
|
+
@input = %{#language:en
|
114
|
+
Feature: 2
|
115
|
+
# 3
|
116
|
+
Scenario: 4
|
117
|
+
Given 5
|
118
|
+
When 6
|
119
|
+
|
120
|
+
@tag8
|
121
|
+
Scenario: 9
|
122
|
+
Given 10
|
123
|
+
When 11
|
124
|
+
| 12 | 12 |
|
125
|
+
| 13 | 13 |
|
126
|
+
}
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should replay identically when there is no filter" do
|
130
|
+
verify_filters([1,2,3,4,5,6,8,9,10,11,12,13,:eof], [])
|
131
|
+
end
|
132
|
+
|
133
|
+
it "should match step line of first scenario" do
|
134
|
+
verify_filters([1,2,3,4,5,6,:eof], [5])
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should match scenario line of second scenario" do
|
138
|
+
verify_filters([1,2,8,9,10,11,12,13,:eof], [9])
|
139
|
+
end
|
140
|
+
|
141
|
+
it "should match tag of second scenario" do
|
142
|
+
verify_filters([1,2,8,9,10,11,12,13,:eof], ['@tag8'])
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should return everything when a line is given in each scenario" do
|
146
|
+
verify_filters([1,2,3,4,5,6,8,9,10,11,12,13,:eof], [6,9])
|
147
|
+
end
|
148
|
+
|
149
|
+
it "should return a scenario when a line is given for its tag" do
|
150
|
+
verify_filters([1,2,8,9,10,11,12,13,:eof], [8])
|
151
|
+
end
|
152
|
+
|
153
|
+
it "should return a scenario when a line is given for its comment" do
|
154
|
+
verify_filters([1,2,3,4,5,6,:eof], [3])
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
context "Scenario with Background and Comment" do
|
159
|
+
before do
|
160
|
+
@input = %{#language:en
|
161
|
+
Feature: 2
|
162
|
+
# 3
|
163
|
+
Background: 4
|
164
|
+
Given 5
|
165
|
+
|
166
|
+
# 7
|
167
|
+
Scenario: 8
|
168
|
+
Given 9
|
169
|
+
When 10
|
170
|
+
|
171
|
+
Scenario: 12
|
172
|
+
Given 13
|
173
|
+
When 14
|
174
|
+
| 15 | 16 |
|
175
|
+
| 15 | 16 |
|
176
|
+
}
|
177
|
+
end
|
178
|
+
|
179
|
+
it "should replay identically when there is no filter" do
|
180
|
+
verify_filters([1,2,3,4,5,7,8,9,10,12,13,14,15,16,:eof], [])
|
181
|
+
end
|
182
|
+
|
183
|
+
it "should not replay any scenarios when filtering on the line of a background step" do
|
184
|
+
verify_filters([1,2,3,4,5,:eof], [5])
|
185
|
+
end
|
186
|
+
|
187
|
+
it "should not replay any scenarios when filtering on the line of the background" do
|
188
|
+
verify_filters([1,2,3,4,5,:eof], [4])
|
189
|
+
end
|
190
|
+
|
191
|
+
it "should replay the background on step line of first scenario" do
|
192
|
+
verify_filters([1,2,3,4,5,7,8,9,10,:eof], [9])
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
context "Scenario Outline" do
|
197
|
+
before do
|
198
|
+
@input = %{Feature: 1
|
199
|
+
|
200
|
+
@tag3
|
201
|
+
Scenario Outline: 4
|
202
|
+
Given <foo> 5
|
203
|
+
When <bar> 6
|
204
|
+
|
205
|
+
@tag8
|
206
|
+
Examples: 9
|
207
|
+
| foo | bar |
|
208
|
+
| 11 | 11 |
|
209
|
+
| 12 | 12 |
|
210
|
+
| 13 | 13 |
|
211
|
+
| 14 | 14 |
|
212
|
+
| 15 | 15 |
|
213
|
+
|
214
|
+
@tag17
|
215
|
+
Examples: 18
|
216
|
+
| snip | snap |
|
217
|
+
| 20 | 20 |
|
218
|
+
| 21 | 21 |
|
219
|
+
|
220
|
+
Scenario: 23
|
221
|
+
Given 24
|
222
|
+
When 25
|
223
|
+
}
|
224
|
+
end
|
225
|
+
|
226
|
+
it "should match step line of first scenario outline" do
|
227
|
+
verify_filters([1,3,4,5,6,8,9,10,11,12,13,14,15,17,18,19,20,21,:eof], [6])
|
228
|
+
end
|
229
|
+
|
230
|
+
it "should match examples line of second scenario outline" do
|
231
|
+
verify_filters([1,3,4,5,6,17,18,19,20,21,:eof], [18])
|
232
|
+
end
|
233
|
+
|
234
|
+
it "should match examples name of second scenario outline" do
|
235
|
+
verify_filters([1,3,4,5,6,17,18,19,20,21,:eof], [/18/])
|
236
|
+
end
|
237
|
+
|
238
|
+
it "should match header row line of second scenario outline" do
|
239
|
+
verify_filters([1,3,4,5,6,17,18,19,20,21,:eof], [19])
|
240
|
+
end
|
241
|
+
|
242
|
+
it "should match an example row of first scenario outline" do
|
243
|
+
verify_filters([1,3,4,5,6,8,9,10,13,:eof], [13])
|
244
|
+
end
|
245
|
+
|
246
|
+
it "should match an example row of second scenario outline" do
|
247
|
+
verify_filters([1,3,4,5,6,17,18,19,20,:eof], [20])
|
248
|
+
end
|
249
|
+
|
250
|
+
it "should match 2 example rows of first scenario outline" do
|
251
|
+
verify_filters([1,3,4,5,6,8,9,10,12,14,:eof], [12,14])
|
252
|
+
end
|
253
|
+
|
254
|
+
it "should replay itself properly" do
|
255
|
+
filtered = %{Feature: 1
|
256
|
+
|
257
|
+
@tag3
|
258
|
+
Scenario Outline: 4
|
259
|
+
Given <foo> 5
|
260
|
+
When <bar> 6
|
261
|
+
|
262
|
+
@tag8
|
263
|
+
Examples: 9
|
264
|
+
| foo | bar |
|
265
|
+
| 12 | 12 |
|
266
|
+
| 14 | 14 |
|
267
|
+
}
|
268
|
+
|
269
|
+
verify_output(filtered, [12,14])
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
context "Scenarios with tags on both feature and scenarios" do
|
274
|
+
before do
|
275
|
+
# Lines with more than one tag per line will be repeated
|
276
|
+
@input = %{#language:en
|
277
|
+
@a @b
|
278
|
+
Feature: 3
|
279
|
+
@c @d
|
280
|
+
Scenario: 5
|
281
|
+
Given 6
|
282
|
+
|
283
|
+
@c @e
|
284
|
+
Scenario: 9
|
285
|
+
Given 10
|
286
|
+
|
287
|
+
Scenario: 12
|
288
|
+
Given 13
|
289
|
+
}
|
290
|
+
end
|
291
|
+
|
292
|
+
it "should match @d" do
|
293
|
+
verify_filters([1,2,2,3,4,4,5,6,:eof], ['@d'])
|
294
|
+
end
|
295
|
+
|
296
|
+
it "should match everything when feature tag matches" do
|
297
|
+
verify_filters([1,2,2,3,4,4,5,6,8,8,9,10,12,13,:eof], ['@a'])
|
298
|
+
end
|
299
|
+
|
300
|
+
it "should match @a && !@d" do
|
301
|
+
verify_filters([1,2,2,3,8,8,9,10,12,13,:eof], ['@a','~@d'])
|
302
|
+
end
|
303
|
+
|
304
|
+
it "should match @d || @e" do
|
305
|
+
verify_filters([1,2,2,3,4,4,5,6,8,8,9,10,:eof], ['@d,@e'])
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
context "Scenario Outlines with tags on examples" do
|
310
|
+
before do
|
311
|
+
# Lines with more than one tag per line will be repeated
|
312
|
+
@input = %{#language:en
|
313
|
+
@a @b
|
314
|
+
Feature: 3
|
315
|
+
@d
|
316
|
+
Scenario Outline: 5
|
317
|
+
Given 6
|
318
|
+
|
319
|
+
@c @e
|
320
|
+
Examples: 9
|
321
|
+
| foo | bar |
|
322
|
+
| 11 | 11 |
|
323
|
+
|
324
|
+
@d @f
|
325
|
+
Examples: 14
|
326
|
+
| foo | bar |
|
327
|
+
| 16 | 16 |
|
328
|
+
| 17 | 17 |
|
329
|
+
|
330
|
+
Scenario: 19
|
331
|
+
Given 20
|
332
|
+
}
|
333
|
+
end
|
334
|
+
|
335
|
+
it "should match @c" do
|
336
|
+
verify_filters([1,2,2,3,4,5,6,8,8,9,10,11,:eof], ['@c'])
|
337
|
+
end
|
338
|
+
|
339
|
+
it "should match @d" do
|
340
|
+
verify_filters([1,2,2,3,4,5,6,8,8,9,10,11,13,13,14,15,16,17,:eof], ['@d'])
|
341
|
+
end
|
342
|
+
|
343
|
+
it "should match @f" do
|
344
|
+
verify_filters([1,2,2,3,4,5,6,13,13,14,15,16,17,:eof], ['@f'])
|
345
|
+
end
|
346
|
+
|
347
|
+
it "should match @a and not @c" do
|
348
|
+
verify_filters([1,2,2,3,4,5,6,13,13,14,15,16,17,19,20,:eof], ['@a','~@c'])
|
349
|
+
end
|
350
|
+
|
351
|
+
it "should match @c or @d" do
|
352
|
+
verify_filters([1,2,2,3,4,5,6,8,8,9,10,11,13,13,14,15,16,17,:eof], ['@c,@d'])
|
353
|
+
end
|
354
|
+
|
355
|
+
it "should not match @m" do
|
356
|
+
verify_filters([:eof], ['@m'])
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
context "Background with PyString" do
|
361
|
+
before do
|
362
|
+
@input = %{#language:en
|
363
|
+
Feature: 2
|
364
|
+
Background: 3
|
365
|
+
Given 4
|
366
|
+
"""
|
367
|
+
6
|
368
|
+
"""
|
369
|
+
|
370
|
+
Scenario: 9
|
371
|
+
Given 10
|
372
|
+
"""
|
373
|
+
12
|
374
|
+
"""
|
375
|
+
|
376
|
+
Scenario: 15
|
377
|
+
Given 16
|
378
|
+
"""
|
379
|
+
18
|
380
|
+
"""
|
381
|
+
}
|
382
|
+
end
|
383
|
+
|
384
|
+
it "should replay itself properly" do
|
385
|
+
verify_filters([1,2,3,4,5,15,16,17,:eof], [15])
|
386
|
+
end
|
387
|
+
end
|
388
|
+
end
|
389
|
+
end
|
390
|
+
end
|