gherkin 1.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/.mailmap +2 -0
- data/History.txt +9 -0
- data/LICENSE +20 -0
- data/README.rdoc +38 -0
- data/Rakefile +48 -0
- data/VERSION.yml +4 -0
- data/bin/gherkin +5 -0
- data/cucumber.yml +3 -0
- data/features/feature_parser.feature +206 -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/gherkin_steps.rb +34 -0
- data/features/step_definitions/pretty_printer_steps.rb +56 -0
- data/features/steps_parser.feature +46 -0
- data/features/support/env.rb +33 -0
- data/gherkin.gemspec +155 -0
- data/java/.gitignore +2 -0
- data/java/Gherkin.iml +24 -0
- data/java/build.xml +13 -0
- data/java/src/gherkin/FixJava.java +34 -0
- data/java/src/gherkin/Lexer.java +5 -0
- data/java/src/gherkin/LexingError.java +7 -0
- data/java/src/gherkin/Listener.java +27 -0
- data/java/src/gherkin/ParseError.java +22 -0
- data/java/src/gherkin/Parser.java +185 -0
- data/java/src/gherkin/lexer/.gitignore +1 -0
- data/java/src/gherkin/parser/StateMachineReader.java +62 -0
- data/lib/.gitignore +4 -0
- data/lib/gherkin.rb +2 -0
- data/lib/gherkin/c_lexer.rb +10 -0
- data/lib/gherkin/cli/main.rb +34 -0
- data/lib/gherkin/core_ext/array.rb +5 -0
- data/lib/gherkin/i18n.rb +87 -0
- data/lib/gherkin/i18n.yml +535 -0
- data/lib/gherkin/i18n_lexer.rb +29 -0
- data/lib/gherkin/java_lexer.rb +10 -0
- data/lib/gherkin/lexer.rb +44 -0
- data/lib/gherkin/parser.rb +19 -0
- data/lib/gherkin/parser/meta.txt +4 -0
- data/lib/gherkin/parser/root.txt +9 -0
- data/lib/gherkin/parser/steps.txt +3 -0
- data/lib/gherkin/rb_lexer.rb +10 -0
- data/lib/gherkin/rb_lexer/.gitignore +1 -0
- data/lib/gherkin/rb_lexer/README.rdoc +8 -0
- data/lib/gherkin/rb_parser.rb +117 -0
- data/lib/gherkin/tools.rb +8 -0
- data/lib/gherkin/tools/files.rb +30 -0
- data/lib/gherkin/tools/pretty_listener.rb +84 -0
- data/lib/gherkin/tools/reformat.rb +19 -0
- data/lib/gherkin/tools/stats.rb +21 -0
- data/lib/gherkin/tools/stats_listener.rb +50 -0
- data/nativegems.sh +5 -0
- data/ragel/i18n/.gitignore +1 -0
- data/ragel/lexer.c.rl.erb +403 -0
- data/ragel/lexer.java.rl.erb +200 -0
- data/ragel/lexer.rb.rl.erb +171 -0
- data/ragel/lexer_common.rl.erb +46 -0
- data/spec/gherkin/c_lexer_spec.rb +21 -0
- data/spec/gherkin/fixtures/1.feature +8 -0
- data/spec/gherkin/fixtures/complex.feature +43 -0
- data/spec/gherkin/fixtures/i18n_fr.feature +13 -0
- data/spec/gherkin/fixtures/i18n_no.feature +6 -0
- data/spec/gherkin/fixtures/i18n_zh-CN.feature +8 -0
- data/spec/gherkin/fixtures/simple.feature +3 -0
- data/spec/gherkin/fixtures/simple_with_comments.feature +7 -0
- data/spec/gherkin/fixtures/simple_with_tags.feature +11 -0
- data/spec/gherkin/i18n_lexer_spec.rb +22 -0
- data/spec/gherkin/i18n_spec.rb +57 -0
- data/spec/gherkin/java_lexer_spec.rb +20 -0
- data/spec/gherkin/parser_spec.rb +28 -0
- data/spec/gherkin/rb_lexer_spec.rb +18 -0
- data/spec/gherkin/sexp_recorder.rb +29 -0
- data/spec/gherkin/shared/lexer_spec.rb +433 -0
- data/spec/gherkin/shared/py_string_spec.rb +124 -0
- data/spec/gherkin/shared/table_spec.rb +97 -0
- data/spec/gherkin/shared/tags_spec.rb +50 -0
- data/spec/spec_helper.rb +53 -0
- data/tasks/bench.rake +186 -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 +70 -0
- data/tasks/cucumber.rake +20 -0
- data/tasks/ragel_task.rb +70 -0
- data/tasks/rdoc.rake +12 -0
- data/tasks/rspec.rake +15 -0
- metadata +196 -0
data/.gitignore
ADDED
data/.mailmap
ADDED
data/History.txt
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
== 1.0.2 (2009-12-30)
|
2
|
+
|
3
|
+
== Bugfixes
|
4
|
+
* Build passes on Ruby 1.9.2 (Aslak Hellesøy)
|
5
|
+
|
6
|
+
== New features
|
7
|
+
* New command line based on trollop. Commands: reformat, stats. (Aslak Hellesøy)
|
8
|
+
* I18nLexer#scan sets #language to the I18n for the language scanned (Mike Sassak)
|
9
|
+
* I18n#adverbs, brings I18n to parity with Cucumber::Parser::NaturalLanguage (Mike Sassak)
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Mike Sassak, Gregory Hnatiuk, Aslak Hellesøy
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
= Gherkin
|
2
|
+
|
3
|
+
Fast Gherkin lexer and parser based on Ragel. Gherkin is two things:
|
4
|
+
|
5
|
+
* The language that has evolved out of the Cucumber project.
|
6
|
+
* This library
|
7
|
+
|
8
|
+
== Running RSpec and Cucumber tests
|
9
|
+
|
10
|
+
rake clean spec cucumber
|
11
|
+
|
12
|
+
== Release process
|
13
|
+
|
14
|
+
* Run "rake clean spec cucumber" for each platform (1.8.6, 1.8.7, 1.9, jruby) to make sure all is green.
|
15
|
+
* rvm 1.8.7
|
16
|
+
* Bump version in the VERSION file
|
17
|
+
* rake clean jar compile
|
18
|
+
* rake gemspec
|
19
|
+
* git commit -a -m "Release vX.Y.Z"
|
20
|
+
* rake release
|
21
|
+
* ./nativegems.sh
|
22
|
+
* gem push pkg/... (for each native gem)
|
23
|
+
|
24
|
+
== Note on Patches/Pull Requests
|
25
|
+
|
26
|
+
* Fork the project.
|
27
|
+
* Run rake ragel:rb to generate all the I18N lexers
|
28
|
+
* Make your feature addition or bug fix.
|
29
|
+
* Add tests for it. This is important so I don't break it in a
|
30
|
+
future version unintentionally.
|
31
|
+
* Commit, do not mess with Rakefile, VERSION, or History.txt.
|
32
|
+
(if you want to have your own version, that is fine but
|
33
|
+
bump version in a commit by itself I can ignore when I pull)
|
34
|
+
* Send me a pull request. Bonus points for topic branches.
|
35
|
+
|
36
|
+
== Copyright
|
37
|
+
|
38
|
+
Copyright (c) 2009 Mike Sassak, Gregory Hnatiuk, Aslak Hellesøy. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rbconfig'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake'
|
5
|
+
require 'rake/clean'
|
6
|
+
|
7
|
+
begin
|
8
|
+
require 'jeweler'
|
9
|
+
Jeweler::Tasks.new do |gem|
|
10
|
+
gem.name = "gherkin"
|
11
|
+
gem.summary = %Q{Fast Gherkin lexer/parser}
|
12
|
+
gem.description = %Q{A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.}
|
13
|
+
gem.email = "cukes@googlegroups.com"
|
14
|
+
gem.homepage = "http://github.com/aslakhellesoy/gherkin"
|
15
|
+
gem.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Hellesøy"]
|
16
|
+
gem.executables = ["gherkin"]
|
17
|
+
gem.add_dependency "trollop", ">= 1.15"
|
18
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
19
|
+
gem.add_development_dependency "cucumber", ">= 0.5.1"
|
20
|
+
gem.add_development_dependency "rake-compiler", ">= 0.7.0" unless defined?(JRUBY_VERSION)
|
21
|
+
|
22
|
+
case ENV['PLATFORM']
|
23
|
+
when 'java'
|
24
|
+
gem.platform = 'java'
|
25
|
+
gem.files += FileList['lib/gherkin.jar']
|
26
|
+
gem.extensions = []
|
27
|
+
when 'i386-mswin32', 'i386-mingw32'
|
28
|
+
gem.platform = ENV['PLATFORM']
|
29
|
+
gem.files += FileList['lib/*.so']
|
30
|
+
gem.extensions = []
|
31
|
+
else
|
32
|
+
gem.files += FileList['lib/gherkin/rb_lexer/*.rb']
|
33
|
+
gem.files += FileList['ext/**/*.c']
|
34
|
+
gem.extensions = FileList['ext/**/extconf.rb']
|
35
|
+
end
|
36
|
+
|
37
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
38
|
+
end
|
39
|
+
Jeweler::GemcutterTasks.new
|
40
|
+
rescue LoadError
|
41
|
+
warn "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
42
|
+
end
|
43
|
+
|
44
|
+
Dir['tasks/**/*.rake'].each { |rake| load File.expand_path(rake) }
|
45
|
+
|
46
|
+
task :default => [:spec, :cucumber]
|
47
|
+
task :spec => defined?(JRUBY_VERSION) ? :jar : :compile
|
48
|
+
task :cucumber => defined?(JRUBY_VERSION) ? :jar : :compile
|
data/VERSION.yml
ADDED
data/bin/gherkin
ADDED
data/cucumber.yml
ADDED
@@ -0,0 +1,206 @@
|
|
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 "en", "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: Tag ends background and scenario
|
77
|
+
Given the following text is parsed:
|
78
|
+
"""
|
79
|
+
Feature: test feature
|
80
|
+
Background:
|
81
|
+
Given a something
|
82
|
+
@tag
|
83
|
+
And something else
|
84
|
+
|
85
|
+
@foo
|
86
|
+
Scenario: my scenario
|
87
|
+
@tag
|
88
|
+
Given this is a step
|
89
|
+
@oh_hai
|
90
|
+
And this is a horrible idea
|
91
|
+
Then it shouldn't work
|
92
|
+
"""
|
93
|
+
Then there should be parse errors on lines 5, 10 and 12
|
94
|
+
|
95
|
+
Scenario: Tables
|
96
|
+
Given the following text is parsed:
|
97
|
+
"""
|
98
|
+
Feature: Antiques Roadshow
|
99
|
+
Scenario Outline: Table
|
100
|
+
Given a <foo>
|
101
|
+
Then a <bar>
|
102
|
+
|
103
|
+
Examples:
|
104
|
+
| foo | bar |
|
105
|
+
| 42 | towel |
|
106
|
+
@hello
|
107
|
+
| 1 | prime |
|
108
|
+
|
109
|
+
Scenario: Table arguments
|
110
|
+
Given this step needs this table:
|
111
|
+
| foo | bar |
|
112
|
+
| one | two |
|
113
|
+
@tag
|
114
|
+
| aaa | bbb |
|
115
|
+
"""
|
116
|
+
Then there should be parse errors on lines 10 and 17
|
117
|
+
|
118
|
+
Scenario: Multiline keyword descriptions
|
119
|
+
Given the following text is parsed:
|
120
|
+
"""
|
121
|
+
Feature: Documentation is fun
|
122
|
+
Scenario Outline: With lots of docs
|
123
|
+
We need lots of embedded documentation for some reason
|
124
|
+
\"\"\" # Not interpreted as a pystring, just plain text
|
125
|
+
Oh hai
|
126
|
+
\"\"\"
|
127
|
+
|
128
|
+
La la la
|
129
|
+
|
130
|
+
Examples:
|
131
|
+
| one | two |
|
132
|
+
| foo | bar |
|
133
|
+
|
134
|
+
\"\"\"
|
135
|
+
Oh Hello
|
136
|
+
\"\"\"
|
137
|
+
|
138
|
+
# Body of the scenario outline starts below
|
139
|
+
Given <something>
|
140
|
+
And something <else>
|
141
|
+
|
142
|
+
# The real examples table
|
143
|
+
Examples:
|
144
|
+
| something | else |
|
145
|
+
| orange | apple |
|
146
|
+
"""
|
147
|
+
Then there should be no parse errors
|
148
|
+
|
149
|
+
Scenario: Scenario Outline with multiple Example groups
|
150
|
+
Given the following text is parsed:
|
151
|
+
"""
|
152
|
+
Feature: Outline Sample
|
153
|
+
|
154
|
+
Scenario: I have no steps
|
155
|
+
|
156
|
+
Scenario Outline: Test state
|
157
|
+
Given <state> without a table
|
158
|
+
Given <other_state> without a table
|
159
|
+
|
160
|
+
Examples: Rainbow colours
|
161
|
+
| state | other_state |
|
162
|
+
| missing | passing |
|
163
|
+
| passing | passing |
|
164
|
+
| failing | passing |
|
165
|
+
|
166
|
+
Examples: Only passing
|
167
|
+
| state | other_state |
|
168
|
+
| passing | passing |
|
169
|
+
"""
|
170
|
+
Then there should be no parse errors
|
171
|
+
|
172
|
+
Scenario: Multiple Scenario Outlines with multiline outline steps
|
173
|
+
Given the following text is parsed:
|
174
|
+
"""
|
175
|
+
Feature: Test
|
176
|
+
Scenario Outline: with step tables
|
177
|
+
Given I have the following fruits in my pantry
|
178
|
+
| name | quantity |
|
179
|
+
| cucumbers | 10 |
|
180
|
+
| strawberrys | 5 |
|
181
|
+
| apricots | 7 |
|
182
|
+
|
183
|
+
When I eat <number> <fruits> from the pantry
|
184
|
+
Then I should have <left> <fruits> in the pantry
|
185
|
+
|
186
|
+
Examples:
|
187
|
+
| number | fruits | left |
|
188
|
+
| 2 | cucumbers | 8 |
|
189
|
+
| 4 | strawberrys | 1 |
|
190
|
+
| 2 | apricots | 5 |
|
191
|
+
|
192
|
+
Scenario Outline: placeholder in a multiline string
|
193
|
+
Given my shopping list
|
194
|
+
\"\"\"
|
195
|
+
Must buy some <fruits>
|
196
|
+
\"\"\"
|
197
|
+
Then my shopping list should equal
|
198
|
+
\"\"\"
|
199
|
+
Must buy some cucumbers
|
200
|
+
\"\"\"
|
201
|
+
|
202
|
+
Examples:
|
203
|
+
| fruits |
|
204
|
+
| cucumbers |
|
205
|
+
"""
|
206
|
+
Then there should be no parse errors
|
@@ -0,0 +1,19 @@
|
|
1
|
+
Feature: Native (C/Java) Lexer
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given a "en", "native" "root" parser
|
5
|
+
|
6
|
+
Scenario: Parsing an empty feature
|
7
|
+
Given the following text is parsed:
|
8
|
+
"""
|
9
|
+
Feature: blah
|
10
|
+
"""
|
11
|
+
Then there should be no parse errors
|
12
|
+
|
13
|
+
Scenario: Parsing a comment
|
14
|
+
Given the following text is parsed:
|
15
|
+
"""
|
16
|
+
# A comment
|
17
|
+
Feature: Hello
|
18
|
+
"""
|
19
|
+
Then there should be no parse errors
|
@@ -0,0 +1,205 @@
|
|
1
|
+
Feature: Gherkin Feature lexer/parser
|
2
|
+
In order to make it easy to control the Gherkin syntax
|
3
|
+
As a Gherkin developer bent on Gherkin world-domination
|
4
|
+
I want a feature lexer that uses a feature parser to
|
5
|
+
make all the syntax decisions for me
|
6
|
+
|
7
|
+
Background:
|
8
|
+
Given a "en", "native" "root" parser
|
9
|
+
|
10
|
+
Scenario: Correctly formed feature
|
11
|
+
When the following text is parsed:
|
12
|
+
"""
|
13
|
+
# Apologies to Bill Watterson
|
14
|
+
@cardboard_box @wip
|
15
|
+
Feature: Transmogrification
|
16
|
+
As a young boy with a hyperactive imagination
|
17
|
+
I want a cardboard box
|
18
|
+
In order to transform the ennui of suburban life into something
|
19
|
+
befitting my imagination
|
20
|
+
|
21
|
+
Background:
|
22
|
+
Given I have a transmogrifier
|
23
|
+
And I am a member of G.R.O.S.S
|
24
|
+
|
25
|
+
Scenario: Whoozit to whatzit transmogrification
|
26
|
+
Given I have a whoozit
|
27
|
+
When I put it in the transmogrifier
|
28
|
+
And I press the "transmogrify" button
|
29
|
+
Then I should have a whatzit
|
30
|
+
|
31
|
+
Scenario Outline: Imaginary Beings
|
32
|
+
Given I have a <boring being>
|
33
|
+
When I transmogrify it with the incantation:
|
34
|
+
\"\"\"
|
35
|
+
ALAKAZAM!
|
36
|
+
\"\"\"
|
37
|
+
Then I should have an <exciting being>
|
38
|
+
|
39
|
+
Examples:
|
40
|
+
| boring being | exciting being |
|
41
|
+
| Sparrow | Alicanto |
|
42
|
+
| Goldfish | Baldanders |
|
43
|
+
| Cow | Hsiao |
|
44
|
+
|
45
|
+
Scenario: Sense of humor detection
|
46
|
+
Given the following excerpt:
|
47
|
+
\"\"\"
|
48
|
+
WOMAN: Who are the Britons?
|
49
|
+
ARTHUR: Well, we all are. we're all Britons and I am your king.
|
50
|
+
WOMAN: I didn't know we had a king. I thought we were an autonomous
|
51
|
+
collective.
|
52
|
+
DENNIS: You're fooling yourself. We're living in a dictatorship.
|
53
|
+
A self-perpetuating autocracy in which the working classes--
|
54
|
+
WOMAN: Oh there you go, bringing class into it again.
|
55
|
+
DENNIS: That's what it's all about if only people would--
|
56
|
+
ARTHUR: Please, please good people. I am in haste. Who lives
|
57
|
+
in that castle?
|
58
|
+
\"\"\"
|
59
|
+
When I read it
|
60
|
+
Then I should be amused
|
61
|
+
"""
|
62
|
+
Then there should be no parse errors
|
63
|
+
|
64
|
+
Scenario: Keyword before feature
|
65
|
+
When the following text is parsed:
|
66
|
+
"""
|
67
|
+
Scenario: Bullying my way to the head of the line
|
68
|
+
Given I am a big bully of a scenario
|
69
|
+
Then I should be caught by the syntax police(y)
|
70
|
+
|
71
|
+
Feature: Too timid to stand up for myself
|
72
|
+
"""
|
73
|
+
Then there should be parse errors on lines 1 through 3
|
74
|
+
|
75
|
+
Scenario: Tag ends background and scenario
|
76
|
+
When the following text is parsed:
|
77
|
+
"""
|
78
|
+
Feature: test feature
|
79
|
+
Background:
|
80
|
+
Given a something
|
81
|
+
@tag
|
82
|
+
And something else
|
83
|
+
|
84
|
+
@foo
|
85
|
+
Scenario: my scenario
|
86
|
+
@tag
|
87
|
+
Given this is a step
|
88
|
+
@oh_hai
|
89
|
+
And this is a horrible idea
|
90
|
+
Then it shouldn't work
|
91
|
+
"""
|
92
|
+
Then there should be parse errors on lines 5, 10 and 12
|
93
|
+
|
94
|
+
Scenario: Tables
|
95
|
+
When the following text is parsed:
|
96
|
+
"""
|
97
|
+
Feature: Antiques Roadshow
|
98
|
+
Scenario Outline: Table
|
99
|
+
Given a <foo>
|
100
|
+
Then a <bar>
|
101
|
+
|
102
|
+
Examples:
|
103
|
+
| foo | bar |
|
104
|
+
| 42 | towel |
|
105
|
+
@hello
|
106
|
+
| 1 | prime |
|
107
|
+
|
108
|
+
Scenario: Table arguments
|
109
|
+
Given this step needs this table:
|
110
|
+
| foo | bar |
|
111
|
+
| one | two |
|
112
|
+
@tag
|
113
|
+
| aaa | bbb |
|
114
|
+
"""
|
115
|
+
Then there should be parse errors on lines 10 and 17
|
116
|
+
|
117
|
+
Scenario: Multiline keyword descriptions
|
118
|
+
When the following text is parsed:
|
119
|
+
"""
|
120
|
+
Feature: Documentation is fun
|
121
|
+
Scenario Outline: With lots of docs
|
122
|
+
We need lots of embedded documentation for some reason
|
123
|
+
\"\"\" # Not interpreted as a pystring, just plain text
|
124
|
+
Oh hai
|
125
|
+
\"\"\"
|
126
|
+
|
127
|
+
La la la
|
128
|
+
|
129
|
+
Examples:
|
130
|
+
| one | two |
|
131
|
+
| foo | bar |
|
132
|
+
|
133
|
+
\"\"\"
|
134
|
+
Oh Hello
|
135
|
+
\"\"\"
|
136
|
+
|
137
|
+
# Body of the scenario outline starts below
|
138
|
+
Given <something>
|
139
|
+
And something <else>
|
140
|
+
|
141
|
+
# The real examples table
|
142
|
+
Examples:
|
143
|
+
| something | else |
|
144
|
+
| orange | apple |
|
145
|
+
"""
|
146
|
+
Then there should be no parse errors
|
147
|
+
|
148
|
+
Scenario: Scenario Outline with multiple Example groups
|
149
|
+
When the following text is parsed:
|
150
|
+
"""
|
151
|
+
Feature: Outline Sample
|
152
|
+
|
153
|
+
Scenario: I have no steps
|
154
|
+
|
155
|
+
Scenario Outline: Test state
|
156
|
+
Given <state> without a table
|
157
|
+
Given <other_state> without a table
|
158
|
+
|
159
|
+
Examples: Rainbow colours
|
160
|
+
| state | other_state |
|
161
|
+
| missing | passing |
|
162
|
+
| passing | passing |
|
163
|
+
| failing | passing |
|
164
|
+
|
165
|
+
Examples: Only passing
|
166
|
+
| state | other_state |
|
167
|
+
| passing | passing |
|
168
|
+
"""
|
169
|
+
Then there should be no parse errors
|
170
|
+
|
171
|
+
Scenario: Multiple Scenario Outlines with multiline outline steps
|
172
|
+
When the following text is parsed:
|
173
|
+
"""
|
174
|
+
Feature: Test
|
175
|
+
Scenario Outline: with step tables
|
176
|
+
Given I have the following fruits in my pantry
|
177
|
+
| name | quantity |
|
178
|
+
| cucumbers | 10 |
|
179
|
+
| strawberrys | 5 |
|
180
|
+
| apricots | 7 |
|
181
|
+
|
182
|
+
When I eat <number> <fruits> from the pantry
|
183
|
+
Then I should have <left> <fruits> in the pantry
|
184
|
+
|
185
|
+
Examples:
|
186
|
+
| number | fruits | left |
|
187
|
+
| 2 | cucumbers | 8 |
|
188
|
+
| 4 | strawberrys | 1 |
|
189
|
+
| 2 | apricots | 5 |
|
190
|
+
|
191
|
+
Scenario Outline: placeholder in a multiline string
|
192
|
+
Given my shopping list
|
193
|
+
\"\"\"
|
194
|
+
Must buy some <fruits>
|
195
|
+
\"\"\"
|
196
|
+
Then my shopping list should equal
|
197
|
+
\"\"\"
|
198
|
+
Must buy some cucumbers
|
199
|
+
\"\"\"
|
200
|
+
|
201
|
+
Examples:
|
202
|
+
| fruits |
|
203
|
+
| cucumbers |
|
204
|
+
"""
|
205
|
+
Then there should be no parse errors
|