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
data/.gitattributes
ADDED
data/.gitignore
ADDED
data/.mailmap
ADDED
data/History.txt
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
== 1.0.30 (2010-05-18)
|
2
|
+
|
3
|
+
=== New Features
|
4
|
+
* Native gems for IronRuby. Bundles IKVM OpenJDK dlls as well as ikvmc-compiled gherkin.dll. Experimental! (Aslak Hellesøy)
|
5
|
+
|
6
|
+
== 1.0.29 (2010-05-18)
|
7
|
+
|
8
|
+
=== Bugfixes
|
9
|
+
* Use I18n.class' class loader instead of context class loader to load Java lexers. Hoping this fixes loading bug for good. (Aslak Hellesøy)
|
10
|
+
|
11
|
+
== 1.0.28 (2010-05-18)
|
12
|
+
|
13
|
+
=== Bugfixes
|
14
|
+
* Use context class loader instead of boot class loader to load Java lexers. (Aslak Hellesøy)
|
15
|
+
* Only add gcc flags when the compiler is gcc. (#60 Aslak Hellesøy, Christian Höltje)
|
16
|
+
|
17
|
+
== 1.0.27 (2010-05-17)
|
18
|
+
|
19
|
+
=== New Features
|
20
|
+
* Table cells can now contain escaped bars - \| and escaped backslashes - \\. (#48. Gregory Hnatiuk, Aslak Hellesøy)
|
21
|
+
* Luxemburgish (lu) added. (Christoph König)
|
22
|
+
|
23
|
+
== 1.0.26 (2010-05-09)
|
24
|
+
|
25
|
+
=== New Features
|
26
|
+
* Ignore the BOM that many retarded Windows editors insist on sticking in the beginning of a file. (Aslak Hellesøy)
|
27
|
+
|
28
|
+
== 1.0.25 (2010-05-02)
|
29
|
+
|
30
|
+
=== Bugfixes
|
31
|
+
* Allow fallback to a slower ruby lexer if the C lexer can't be loaded for some reason.
|
32
|
+
* Can't run specs in gherkin 1.0.24 (#59 Aslak Hellesøy)
|
33
|
+
|
34
|
+
== 1.0.24 (2010-05-02)
|
35
|
+
|
36
|
+
=== Bugfixes
|
37
|
+
* hard tabs crazy indentation for pystrings in formatter (#55 Aslak Hellesøy)
|
38
|
+
|
39
|
+
== 1.0.23 (2010-05-02)
|
40
|
+
|
41
|
+
=== Changed Features
|
42
|
+
* Java API now uses camelCased method names instead of underscored (more Java-like) (Aslak Hellesøy)
|
43
|
+
|
44
|
+
== 1.0.22 (2010-04-28)
|
45
|
+
|
46
|
+
=== Bugfixes
|
47
|
+
* Make prebuilt binaries work on both Ruby 1.8.x and 1.9.x on Windows (#54 Luis Lavena, Aslak Hellesøy)
|
48
|
+
|
49
|
+
== 1.0.21 (2010-04-27)
|
50
|
+
|
51
|
+
=== Bugfixes
|
52
|
+
* Fix compile warning on ruby 1.9.2dev (2009-07-18 trunk 24186) (#53 Aslak Hellesøy)
|
53
|
+
|
54
|
+
== 1.0.20 (2010-04-20)
|
55
|
+
|
56
|
+
=== Bugfixes
|
57
|
+
* The gherkin CLI is working again (Gregory Hnatiuk)
|
58
|
+
|
59
|
+
== 1.0.19 (2010-04-20)
|
60
|
+
|
61
|
+
=== New Features
|
62
|
+
* Works with JRuby 1.5.0.RC1 (Aslak Hellesøy)
|
63
|
+
|
64
|
+
=== Changed Features
|
65
|
+
* I18n.code_keywords now return And and But as well, making Cucumber StepDefs a little more flexible (Aslak Hellesøy)
|
66
|
+
|
67
|
+
== 1.0.18 (2010-04-20)
|
68
|
+
|
69
|
+
=== Bugfixes
|
70
|
+
* Explicitly use UTF-8 encoding when scanning source with Java lexer. (Aslak Hellesøy)
|
71
|
+
|
72
|
+
== 1.0.17 (2010-04-19)
|
73
|
+
|
74
|
+
=== Bugfixes
|
75
|
+
* Gherkin::I18n.keyword_regexp was broken (used for 3rd party code generation). (#51 Aslak Hellesøy)
|
76
|
+
|
77
|
+
== 1.0.16 (2010-04-19)
|
78
|
+
(Something went wrong when releasing 1.0.15)
|
79
|
+
|
80
|
+
=== Bugfixes
|
81
|
+
* Reduced risk of halfway botched releases. (Aslak Hellesøy)
|
82
|
+
|
83
|
+
== 1.0.15 (2010-04-19)
|
84
|
+
|
85
|
+
=== New Features
|
86
|
+
* Implemented more functionality in I18n.java. (Aslak Hellesøy)
|
87
|
+
|
88
|
+
=== Changed Features
|
89
|
+
* Java methods are no longer throwing Exception (but RuntimeException). (Aslak Hellesøy)
|
90
|
+
|
91
|
+
== 1.0.14 (2010-04-18)
|
92
|
+
(Something went wrong when releasing 1.0.13)
|
93
|
+
|
94
|
+
== 1.0.13 (2010-04-18)
|
95
|
+
|
96
|
+
=== New Features
|
97
|
+
* Filter on Background name. (Aslak Hellesøy)
|
98
|
+
|
99
|
+
== 1.0.12 (2010-04-18)
|
100
|
+
|
101
|
+
=== Bugfixes
|
102
|
+
* Fixed incorrect filtering of pystring in Background. (Mike Sassak)
|
103
|
+
|
104
|
+
== 1.0.11 (2010-04-16)
|
105
|
+
|
106
|
+
=== Bugfixes
|
107
|
+
* Fixed bad packaging (C files were not packaged in POSIX gem)
|
108
|
+
|
109
|
+
== 1.0.10 (2010-04-16)
|
110
|
+
|
111
|
+
=== New Features
|
112
|
+
* Added Esperanto and added a Russian synonym for Feature. (Antono Vasiljev)
|
113
|
+
* Pure Java implementation of FilterListener and TagExpression (Mike Gaffney, Aslak Hellesøy)
|
114
|
+
|
115
|
+
=== Changed Features
|
116
|
+
* TagExpression takes array args instead of varargs. (Aslak Hellesøy)
|
117
|
+
|
118
|
+
== 1.0.9 (2010-04-12)
|
119
|
+
|
120
|
+
=== Bugfixes
|
121
|
+
* Triple escaped quotes (\"\"\") in PyStrings are unescaped to """. (Aslak Hellesøy)
|
122
|
+
|
123
|
+
== 1.0.8 (2010-04-10)
|
124
|
+
|
125
|
+
=== Bugfixes
|
126
|
+
* Removed illegal comma from Ukrainian synonym. (Aslak Hellesøy)
|
127
|
+
|
128
|
+
== 1.0.7 (2010-04-10)
|
129
|
+
|
130
|
+
=== Bugfixes
|
131
|
+
* Fixed problems with packaging of 1.0.6 release. (Aslak Hellesøy)
|
132
|
+
|
133
|
+
== 1.0.6 (2010-04-10)
|
134
|
+
|
135
|
+
=== New Features
|
136
|
+
* Fully automated release process. (Aslak Hellesøy)
|
137
|
+
|
138
|
+
=== Changed Features
|
139
|
+
* Made generated classes use a more uniform naming convention. (Aslak Hellesøy)
|
140
|
+
|
141
|
+
=== Removed Features
|
142
|
+
* Removed C# port, obsoleted by IKVM build from 1.0.5. (Aslak Hellesøy)
|
143
|
+
|
144
|
+
== 1.0.5 (2010-04-08)
|
145
|
+
|
146
|
+
=== New Features
|
147
|
+
* New .NET build of gherkin - an ikvmc build of gherkin.jar to gherkin.dll. (Aslak Hellesøy)
|
148
|
+
|
149
|
+
=== Bugfixes
|
150
|
+
* Made parsers reusable so that the same instance can parse several features. (Aslak Hellesøy)
|
151
|
+
|
152
|
+
== 1.0.4 (2010-04-07)
|
153
|
+
|
154
|
+
=== New features
|
155
|
+
* Pure java releases of Gherkin at http://cukes.info/maven
|
156
|
+
* A FilterListener in Ruby that is the last missing piece to plug Gherkin into Cucumber. (Gregory Hnatiuk, Aslak Hellesøy, Matt Wynne, Mike Sassak)
|
157
|
+
|
158
|
+
=== Changed features
|
159
|
+
* The Lexer now emits the '@' for tags. (Aslak Hellesøy)
|
160
|
+
|
161
|
+
== 1.0.3 (2010-03-31)
|
162
|
+
|
163
|
+
=== Bugfixes
|
164
|
+
* The C lexer correctly instantiates a new array for each table, instead of reusing the old one. (Aslak Hellesøy)
|
165
|
+
* Emit keywords with space instead of stripping (< keywords are emmitted without space) (Aslak Hellesøy)
|
166
|
+
* gherkin reformat now prints comments, and does it with proper indentation (Aslak Hellesøy)
|
167
|
+
* .NET resource files are now automatically copied into the .dll (#46 Aslak Hellesøy)
|
168
|
+
|
169
|
+
=== New features
|
170
|
+
* The Pure Java implementation now has a simple main method that pretty prints a feature. (#39 Aslak Hellesøy)
|
171
|
+
* Writing code generated i18n syntax highlighters for Gherkin is a lot easier thanks to several convenience methods in Gherkin::I18n. (Aslak Hellesøy)
|
172
|
+
* .NET (C#) port (#36, #37 Attila Sztupak)
|
173
|
+
* Tables parsed and sent by row rather than by table. (Mike Sassak)
|
174
|
+
|
175
|
+
=== Changed features
|
176
|
+
* Switced to ISO 639-1 (language) and ISO 3166 alpha-2 (region - if applicable). Applies to Catalan,
|
177
|
+
Swedish, Welsh, Romanian and Serbian. (Aslak Hellesøy)
|
178
|
+
|
179
|
+
== 1.0.2 (2009-12-30)
|
180
|
+
|
181
|
+
=== Bugfixes
|
182
|
+
* Build passes on Ruby 1.9.2 (Aslak Hellesøy)
|
183
|
+
|
184
|
+
=== New features
|
185
|
+
* New command line based on trollop. Commands: reformat, stats. (Aslak Hellesøy)
|
186
|
+
* I18nLexer#scan sets #language to the I18n for the language scanned (Mike Sassak)
|
187
|
+
* 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,59 @@
|
|
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
|
+
== Generating and building the code
|
9
|
+
|
10
|
+
You'll need MRI (any version) if you want to build for MRI. To build the Java implementation you'll need JRuby.
|
11
|
+
You'll also need Ragel installed and on your PATH.
|
12
|
+
Finally you'll need the jeweler gem. (Jeweler will tell you what other gems you need when you run rake)
|
13
|
+
|
14
|
+
=== MRI
|
15
|
+
|
16
|
+
rake clean compile
|
17
|
+
|
18
|
+
=== Java
|
19
|
+
|
20
|
+
rake clean jar
|
21
|
+
|
22
|
+
== Running RSpec and Cucumber tests
|
23
|
+
|
24
|
+
rake clean spec cucumber
|
25
|
+
|
26
|
+
If the RL_LANG environment variable is set, only the parsers for the languages specified there will be built.
|
27
|
+
E.g. in Bash, export RL_LANG="en,fr,no". This can be quite helpful when modifying the Ragel grammar.
|
28
|
+
|
29
|
+
== Release process
|
30
|
+
|
31
|
+
* Bump version in the VERSION.yml file and:
|
32
|
+
** java/pom.xml
|
33
|
+
** ikvm/Gherkin/Gherkin.csproj
|
34
|
+
* rake release:ALL
|
35
|
+
* Announce on Cucumber list, IRC and Twitter.
|
36
|
+
|
37
|
+
== Configuring Rake-Compiler for cross compilation
|
38
|
+
In order to build Windows binaries (so we can release Windows gems from OS X/Linux) we need to set up rake-compiler.
|
39
|
+
|
40
|
+
http://github.com/luislavena/rake-compiler/
|
41
|
+
|
42
|
+
I didn't want to install macports (I'm on homebrew) and I couldn't figure out how to build MinGW myself. I got prebuilt binaries:
|
43
|
+
http://crossgcc.rts-software.org/doku.php - just add the bin folder to your PATH
|
44
|
+
|
45
|
+
== Note on Patches/Pull Requests
|
46
|
+
|
47
|
+
* Fork the project.
|
48
|
+
* Run rake ragel:rb to generate all the I18N lexers
|
49
|
+
* Make your feature addition or bug fix.
|
50
|
+
* Add tests for it. This is important so I don't break it in a
|
51
|
+
future version unintentionally.
|
52
|
+
* Commit, do not mess with Rakefile, VERSION, or History.txt.
|
53
|
+
(if you want to have your own version, that is fine but
|
54
|
+
bump version in a commit by itself I can ignore when I pull)
|
55
|
+
* Send me a pull request. Bonus points for topic branches.
|
56
|
+
|
57
|
+
== Copyright
|
58
|
+
|
59
|
+
Copyright (c) 2009 Mike Sassak, Gregory Hnatiuk, Aslak Hellesøy. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'rbconfig'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'rake'
|
5
|
+
require 'rake/clean'
|
6
|
+
require 'yaml'
|
7
|
+
|
8
|
+
config = YAML.load_file('VERSION.yml')
|
9
|
+
GHERKIN_VERSION = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
10
|
+
|
11
|
+
begin
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
gem.name = "gherkin"
|
15
|
+
gem.summary = %Q{Fast Gherkin lexer/parser}
|
16
|
+
gem.description = %Q{A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.}
|
17
|
+
gem.email = "cukes@googlegroups.com"
|
18
|
+
gem.homepage = "http://github.com/aslakhellesoy/gherkin"
|
19
|
+
gem.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Hellesøy"]
|
20
|
+
gem.executables = ["gherkin"]
|
21
|
+
gem.add_dependency "trollop", ">= 1.16.2"
|
22
|
+
gem.add_development_dependency "rspec", ">= 1.3.0"
|
23
|
+
gem.add_development_dependency "cucumber", ">= 0.7.2"
|
24
|
+
gem.add_development_dependency "rake-compiler", ">= 0.7.0" unless defined?(JRUBY_VERSION)
|
25
|
+
|
26
|
+
gem.files -= FileList['ikvm/**/*']
|
27
|
+
gem.files -= FileList['java/**/*']
|
28
|
+
case ENV['PLATFORM']
|
29
|
+
when 'java'
|
30
|
+
gem.platform = 'java'
|
31
|
+
gem.files += FileList['lib/gherkin.jar']
|
32
|
+
gem.extensions = []
|
33
|
+
when 'i386-mswin32', 'i386-mingw32'
|
34
|
+
gem.platform = ENV['PLATFORM']
|
35
|
+
gem.files += FileList['lib/*/*.so']
|
36
|
+
gem.extensions = []
|
37
|
+
when 'universal-dotnet'
|
38
|
+
gem.platform = ENV['PLATFORM']
|
39
|
+
gem.files += FileList['lib/*.dll']
|
40
|
+
gem.extensions = []
|
41
|
+
else
|
42
|
+
gem.files += FileList['lib/gherkin/rb_lexer/*.rb']
|
43
|
+
gem.files += FileList['ext/**/*.c']
|
44
|
+
gem.extensions = FileList['ext/**/extconf.rb']
|
45
|
+
end
|
46
|
+
|
47
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
48
|
+
end
|
49
|
+
Jeweler::GemcutterTasks.new
|
50
|
+
rescue LoadError
|
51
|
+
warn "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
52
|
+
end
|
53
|
+
|
54
|
+
Dir['tasks/**/*.rake'].each { |rake| load File.expand_path(rake) }
|
55
|
+
|
56
|
+
task :default => [:spec, :cucumber]
|
57
|
+
task :spec => defined?(JRUBY_VERSION) ? :jar : :compile
|
58
|
+
task :cucumber => defined?(JRUBY_VERSION) ? :jar : :compile
|
data/VERSION.yml
ADDED
data/bin/gherkin
ADDED
data/cucumber.yml
ADDED
@@ -0,0 +1,226 @@
|
|
1
|
+
# language: en
|
2
|
+
Feature: Gherkin Feature lexer
|
3
|
+
In order to make it easy to control the Gherkin syntax
|
4
|
+
As a Gherkin developer bent on Gherkin world-domination
|
5
|
+
I want a feature lexer that uses a feature parser to
|
6
|
+
make all the syntax decisions for me
|
7
|
+
|
8
|
+
Background:
|
9
|
+
Given a "ruby" "root" parser
|
10
|
+
|
11
|
+
Scenario: Correctly formed feature
|
12
|
+
Given the following text is parsed:
|
13
|
+
"""
|
14
|
+
# Apologies to Bill Watterson
|
15
|
+
@cardboard_box @wip
|
16
|
+
Feature: Transmogrification
|
17
|
+
As a young boy with a hyperactive imagination
|
18
|
+
I want a cardboard box
|
19
|
+
In order to transform the ennui of suburban life into something
|
20
|
+
befitting my imagination
|
21
|
+
|
22
|
+
Background:
|
23
|
+
Given I have a transmogrifier
|
24
|
+
And I am a member of G.R.O.S.S
|
25
|
+
|
26
|
+
Scenario: Whoozit to whatzit transmogrification
|
27
|
+
Given I have a whoozit
|
28
|
+
When I put it in the transmogrifier
|
29
|
+
And I press the "transmogrify" button
|
30
|
+
Then I should have a whatzit
|
31
|
+
|
32
|
+
Scenario Outline: Imaginary Beings
|
33
|
+
Given I have a <boring being>
|
34
|
+
When I transmogrify it with the incantation:
|
35
|
+
\"\"\"
|
36
|
+
ALAKAZAM!
|
37
|
+
\"\"\"
|
38
|
+
Then I should have an <exciting being>
|
39
|
+
|
40
|
+
Examples:
|
41
|
+
| boring being | exciting being |
|
42
|
+
| Sparrow | Alicanto |
|
43
|
+
| Goldfish | Baldanders |
|
44
|
+
| Cow | Hsiao |
|
45
|
+
|
46
|
+
Scenario: Sense of humor detection
|
47
|
+
Given the following excerpt:
|
48
|
+
\"\"\"
|
49
|
+
WOMAN: Who are the Britons?
|
50
|
+
ARTHUR: Well, we all are. we're all Britons and I am your king.
|
51
|
+
WOMAN: I didn't know we had a king. I thought we were an autonomous
|
52
|
+
collective.
|
53
|
+
DENNIS: You're fooling yourself. We're living in a dictatorship.
|
54
|
+
A self-perpetuating autocracy in which the working classes--
|
55
|
+
WOMAN: Oh there you go, bringing class into it again.
|
56
|
+
DENNIS: That's what it's all about if only people would--
|
57
|
+
ARTHUR: Please, please good people. I am in haste. Who lives
|
58
|
+
in that castle?
|
59
|
+
\"\"\"
|
60
|
+
When I read it
|
61
|
+
Then I should be amused
|
62
|
+
"""
|
63
|
+
Then there should be no parse errors
|
64
|
+
|
65
|
+
Scenario: Keyword before feature
|
66
|
+
Given the following text is parsed:
|
67
|
+
"""
|
68
|
+
Scenario: Bullying my way to the head of the line
|
69
|
+
Given I am a big bully of a scenario
|
70
|
+
Then I should be caught by the syntax police(y)
|
71
|
+
|
72
|
+
Feature: Too timid to stand up for myself
|
73
|
+
"""
|
74
|
+
Then there should be parse errors on lines 1 through 3
|
75
|
+
|
76
|
+
Scenario: 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: Malformed 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: Well-formed Tables
|
119
|
+
Given the following text is parsed:
|
120
|
+
"""
|
121
|
+
Feature: Row-by-row
|
122
|
+
|
123
|
+
Scenario: Tables with comments!
|
124
|
+
Given I can now comment out a row:
|
125
|
+
| Key | Value |
|
126
|
+
# | Yes | No |
|
127
|
+
# | Good | Bad |
|
128
|
+
| Good | Evil |
|
129
|
+
Then I am pleased by these things:
|
130
|
+
| Raindrops | Roses |
|
131
|
+
# | Whiskers | Kittens |
|
132
|
+
| Bright Copper | Kettles |
|
133
|
+
# | Warm woolen | Mittens |
|
134
|
+
| Also Oban | And Hendricks |
|
135
|
+
"""
|
136
|
+
Then there should be no parse errors
|
137
|
+
|
138
|
+
Scenario: Multiline keyword descriptions
|
139
|
+
Given the following text is parsed:
|
140
|
+
"""
|
141
|
+
Feature: Documentation is fun
|
142
|
+
Scenario Outline: With lots of docs
|
143
|
+
We need lots of embedded documentation for some reason
|
144
|
+
\"\"\" # Not interpreted as a pystring, just plain text
|
145
|
+
Oh hai
|
146
|
+
\"\"\"
|
147
|
+
|
148
|
+
La la la
|
149
|
+
|
150
|
+
Examples:
|
151
|
+
| one | two |
|
152
|
+
| foo | bar |
|
153
|
+
|
154
|
+
\"\"\"
|
155
|
+
Oh Hello
|
156
|
+
\"\"\"
|
157
|
+
|
158
|
+
# Body of the scenario outline starts below
|
159
|
+
Given <something>
|
160
|
+
And something <else>
|
161
|
+
|
162
|
+
# The real examples table
|
163
|
+
Examples:
|
164
|
+
| something | else |
|
165
|
+
| orange | apple |
|
166
|
+
"""
|
167
|
+
Then there should be no parse errors
|
168
|
+
|
169
|
+
Scenario: Scenario Outline with multiple Example groups
|
170
|
+
Given the following text is parsed:
|
171
|
+
"""
|
172
|
+
Feature: Outline Sample
|
173
|
+
|
174
|
+
Scenario: I have no steps
|
175
|
+
|
176
|
+
Scenario Outline: Test state
|
177
|
+
Given <state> without a table
|
178
|
+
Given <other_state> without a table
|
179
|
+
|
180
|
+
Examples: Rainbow colours
|
181
|
+
| state | other_state |
|
182
|
+
| missing | passing |
|
183
|
+
| passing | passing |
|
184
|
+
| failing | passing |
|
185
|
+
|
186
|
+
Examples: Only passing
|
187
|
+
| state | other_state |
|
188
|
+
| passing | passing |
|
189
|
+
"""
|
190
|
+
Then there should be no parse errors
|
191
|
+
|
192
|
+
Scenario: Multiple Scenario Outlines with multiline outline steps
|
193
|
+
Given the following text is parsed:
|
194
|
+
"""
|
195
|
+
Feature: Test
|
196
|
+
Scenario Outline: with step tables
|
197
|
+
Given I have the following fruits in my pantry
|
198
|
+
| name | quantity |
|
199
|
+
| cucumbers | 10 |
|
200
|
+
| strawberrys | 5 |
|
201
|
+
| apricots | 7 |
|
202
|
+
|
203
|
+
When I eat <number> <fruits> from the pantry
|
204
|
+
Then I should have <left> <fruits> in the pantry
|
205
|
+
|
206
|
+
Examples:
|
207
|
+
| number | fruits | left |
|
208
|
+
| 2 | cucumbers | 8 |
|
209
|
+
| 4 | strawberrys | 1 |
|
210
|
+
| 2 | apricots | 5 |
|
211
|
+
|
212
|
+
Scenario Outline: placeholder in a multiline string
|
213
|
+
Given my shopping list
|
214
|
+
\"\"\"
|
215
|
+
Must buy some <fruits>
|
216
|
+
\"\"\"
|
217
|
+
Then my shopping list should equal
|
218
|
+
\"\"\"
|
219
|
+
Must buy some cucumbers
|
220
|
+
\"\"\"
|
221
|
+
|
222
|
+
Examples:
|
223
|
+
| fruits |
|
224
|
+
| cucumbers |
|
225
|
+
"""
|
226
|
+
Then there should be no parse errors
|