gherkin 0.0.4-i386-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/LICENSE +20 -0
- data/README.rdoc +66 -0
- data/Rakefile +49 -0
- data/VERSION.yml +4 -0
- data/bin/gherkin +10 -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 +180 -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/core_ext/array.rb +5 -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 +43 -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/pretty_printer.rb +83 -0
- data/nativegems.sh +5 -0
- data/ragel/i18n/.gitignore +1 -0
- data/ragel/lexer.c.rl.erb +401 -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_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 +193 -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 +83 -0
- data/tasks/rdoc.rake +12 -0
- data/tasks/rspec.rake +15 -0
- metadata +214 -0
@@ -0,0 +1,14 @@
|
|
1
|
+
Feature: Pretty printer
|
2
|
+
In order to have pretty gherkin
|
3
|
+
I want to verify that all prettified cucumber features parse OK
|
4
|
+
|
5
|
+
Scenario: Parse all the features in Cucumber
|
6
|
+
Given I have Cucumber's home dir defined in CUCUMBER_HOME
|
7
|
+
When I find all of the .feature files
|
8
|
+
And I parse the prettified representation of each of them
|
9
|
+
# Of course, we don't really want any errors. The last
|
10
|
+
# two files that were not identical are written to p1.feature
|
11
|
+
# and p2.feature. Do a diff -u p1.feature p2.feature
|
12
|
+
#
|
13
|
+
Then the following files should have errors:
|
14
|
+
| Path | Error |
|
@@ -0,0 +1,34 @@
|
|
1
|
+
Given /^a "([^\"]*)", "([^\"]*)" "([^\"]*)" parser$/ do |i18n_language, impl, parser_name|
|
2
|
+
parser = Gherkin::Parser.new(@listener, false, parser_name)
|
3
|
+
programming_language = {
|
4
|
+
'ruby' => 'rb',
|
5
|
+
'native' => (defined?(JRUBY_VERSION) ? 'java' : 'c')
|
6
|
+
}[impl]
|
7
|
+
@lexer = Gherkin::Lexer.send(programming_language)[i18n_language].new(parser)
|
8
|
+
end
|
9
|
+
|
10
|
+
Given "the following text is parsed:" do |text|
|
11
|
+
@lexer.scan(text)
|
12
|
+
end
|
13
|
+
|
14
|
+
Then "there should be no parse errors" do
|
15
|
+
@listener.errors.should == []
|
16
|
+
end
|
17
|
+
|
18
|
+
Then /^there should be a parse error on (line \d+)$/ do |line|
|
19
|
+
@listener.line(line).should include(:syntax_error, line)
|
20
|
+
end
|
21
|
+
|
22
|
+
Then /^there should be parse errors on (lines .*)$/ do |lines|
|
23
|
+
lines.each do |line|
|
24
|
+
Then "there should be a parse error on line #{line}"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
Transform /^line \d+$/ do |step_arg|
|
29
|
+
tr_line_number(step_arg)
|
30
|
+
end
|
31
|
+
|
32
|
+
Transform /^lines .*$/ do |step_arg|
|
33
|
+
tr_line_numbers(step_arg)
|
34
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'stringio'
|
2
|
+
require 'gherkin'
|
3
|
+
require 'gherkin/tools/pretty_printer'
|
4
|
+
|
5
|
+
module PrettyPlease
|
6
|
+
def pretty(source)
|
7
|
+
io = StringIO.new
|
8
|
+
listener = Gherkin::Tools::PrettyPrinter.new(io)
|
9
|
+
parser = Gherkin::Parser.new(listener, true)
|
10
|
+
lexer = Gherkin::I18nLexer.new(parser)
|
11
|
+
lexer.scan(source)
|
12
|
+
io.rewind
|
13
|
+
io.read
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
World(PrettyPlease)
|
18
|
+
|
19
|
+
Given /^I have Cucumber's home dir defined in CUCUMBER_HOME$/ do
|
20
|
+
@cucumber_home = ENV['CUCUMBER_HOME']
|
21
|
+
raise "No CUCUMBER_HOME" if @cucumber_home.nil?
|
22
|
+
end
|
23
|
+
|
24
|
+
When /^I find all of the \.feature files$/ do
|
25
|
+
@features = Dir["#{@cucumber_home}/**/*.feature"].sort
|
26
|
+
end
|
27
|
+
|
28
|
+
When /^I parse the prettified representation of each of them$/ do
|
29
|
+
@errors = [['Path', 'Error']]
|
30
|
+
@features.each do |feature|
|
31
|
+
pretty1 = nil
|
32
|
+
pretty2 = nil
|
33
|
+
begin
|
34
|
+
# announce "========== #{feature}:"
|
35
|
+
pretty1 = pretty(IO.read(feature))
|
36
|
+
pretty2 = pretty(pretty1)
|
37
|
+
pretty2.should == pretty1
|
38
|
+
rescue Spec::Expectations::ExpectationNotMetError => e
|
39
|
+
File.open("p1.feature", "w") {|io| io.write(pretty1)}
|
40
|
+
File.open("p2.feature", "w") {|io| io.write(pretty2)}
|
41
|
+
announce "========== #{feature}:"
|
42
|
+
if(e.message =~ /(@@.*)/m)
|
43
|
+
announce $1
|
44
|
+
else
|
45
|
+
announce "??? NO DIFF ???"
|
46
|
+
end
|
47
|
+
@errors << [feature, "See announced diff"]
|
48
|
+
rescue => e
|
49
|
+
@errors << [feature, e.message]
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
Then /^the following files should have errors:$/ do |table|
|
55
|
+
table.diff!(@errors)
|
56
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
Feature: Gherkin Steps parser
|
2
|
+
In order to save time and make my features clearer
|
3
|
+
As a Cucumber developer
|
4
|
+
I want a steps parser to make writing compound steps easier
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given a "en", "ruby" "steps" parser
|
8
|
+
|
9
|
+
Scenario: Parsing steps
|
10
|
+
Given the following text is parsed:
|
11
|
+
"""
|
12
|
+
Given a one step
|
13
|
+
And a two step
|
14
|
+
\"\"\"
|
15
|
+
Here is a multiline string
|
16
|
+
That follows a step
|
17
|
+
With an argument #{arg}
|
18
|
+
\"\"\"
|
19
|
+
And a one two three step
|
20
|
+
When another step
|
21
|
+
Then there should be a table
|
22
|
+
| one | two | three |
|
23
|
+
| foo | bar | #{arg} |
|
24
|
+
"""
|
25
|
+
Then there should be no parse errors
|
26
|
+
|
27
|
+
Scenario: Trying to parse a full feature with the step parser
|
28
|
+
Given the following text is parsed:
|
29
|
+
"""
|
30
|
+
Feature: A Feature
|
31
|
+
Scenario: Yes, there is one
|
32
|
+
Given I have a step
|
33
|
+
When I execute this step
|
34
|
+
Then something should happen
|
35
|
+
"""
|
36
|
+
Then there should be parse errors on lines 1 and 2
|
37
|
+
|
38
|
+
Scenario: Tags
|
39
|
+
Given the following text is parsed:
|
40
|
+
"""
|
41
|
+
@a_tag
|
42
|
+
Given a step
|
43
|
+
When I trip
|
44
|
+
Then I should sign up for dancing lessons
|
45
|
+
"""
|
46
|
+
Then there should be a parse error on line 1
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# I'm sure there's a better way than this...
|
2
|
+
%w{/../../lib /../../spec/gherkin}.each do |path|
|
3
|
+
$LOAD_PATH << File.expand_path(File.dirname(__FILE__) + path)
|
4
|
+
end
|
5
|
+
|
6
|
+
require 'gherkin'
|
7
|
+
require "sexp_recorder"
|
8
|
+
|
9
|
+
module TransformHelpers
|
10
|
+
def tr_line_number(step_arg)
|
11
|
+
/(\d+)$/.match(step_arg)[0].to_i
|
12
|
+
end
|
13
|
+
|
14
|
+
def tr_line_numbers(step_arg)
|
15
|
+
if step_arg =~ /through/
|
16
|
+
Range.new(*step_arg.scan(/\d+/).collect { |i| i.to_i })
|
17
|
+
else
|
18
|
+
step_arg.scan(/\d+/).collect { |i| i.to_i }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class GherkinWorld
|
24
|
+
include TransformHelpers
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
@listener = Gherkin::SexpRecorder.new
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
World do
|
32
|
+
GherkinWorld.new
|
33
|
+
end
|
data/gherkin.gemspec
ADDED
@@ -0,0 +1,180 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{gherkin}
|
8
|
+
s.version = "0.0.4"
|
9
|
+
s.platform = %q{i386-mingw32}
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.authors = ["Mike Sassak", "Gregory Hnatiuk", "Aslak Helles\303\270y"]
|
13
|
+
s.date = %q{2009-11-28}
|
14
|
+
s.default_executable = %q{gherkin}
|
15
|
+
s.description = %q{A fast Gherkin lexer in Ragel}
|
16
|
+
s.email = %q{cukes@googlegroups.com}
|
17
|
+
s.executables = ["gherkin"]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE",
|
20
|
+
"README.rdoc"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".gitignore",
|
24
|
+
"LICENSE",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION.yml",
|
28
|
+
"bin/gherkin",
|
29
|
+
"cucumber.yml",
|
30
|
+
"features/feature_parser.feature",
|
31
|
+
"features/native_lexer.feature",
|
32
|
+
"features/parser_with_native_lexer.feature",
|
33
|
+
"features/pretty_printer.feature",
|
34
|
+
"features/step_definitions/gherkin_steps.rb",
|
35
|
+
"features/step_definitions/pretty_printer_steps.rb",
|
36
|
+
"features/steps_parser.feature",
|
37
|
+
"features/support/env.rb",
|
38
|
+
"gherkin.gemspec",
|
39
|
+
"java/.gitignore",
|
40
|
+
"java/Gherkin.iml",
|
41
|
+
"java/build.xml",
|
42
|
+
"java/src/gherkin/FixJava.java",
|
43
|
+
"java/src/gherkin/Lexer.java",
|
44
|
+
"java/src/gherkin/LexingError.java",
|
45
|
+
"java/src/gherkin/Listener.java",
|
46
|
+
"java/src/gherkin/ParseError.java",
|
47
|
+
"java/src/gherkin/Parser.java",
|
48
|
+
"java/src/gherkin/lexer/.gitignore",
|
49
|
+
"java/src/gherkin/parser/StateMachineReader.java",
|
50
|
+
"lib/.gitignore",
|
51
|
+
"lib/gherkin.rb",
|
52
|
+
"lib/gherkin/c_lexer.rb",
|
53
|
+
"lib/gherkin/core_ext/array.rb",
|
54
|
+
"lib/gherkin/i18n.yml",
|
55
|
+
"lib/gherkin/i18n_lexer.rb",
|
56
|
+
"lib/gherkin/java_lexer.rb",
|
57
|
+
"lib/gherkin/lexer.rb",
|
58
|
+
"lib/gherkin/parser.rb",
|
59
|
+
"lib/gherkin/parser/meta.txt",
|
60
|
+
"lib/gherkin/parser/root.txt",
|
61
|
+
"lib/gherkin/parser/steps.txt",
|
62
|
+
"lib/gherkin/rb_lexer.rb",
|
63
|
+
"lib/gherkin/rb_lexer/.gitignore",
|
64
|
+
"lib/gherkin/rb_lexer/README.rdoc",
|
65
|
+
"lib/gherkin/rb_parser.rb",
|
66
|
+
"lib/gherkin/tools/pretty_printer.rb",
|
67
|
+
"lib/gherkin_lexer_ar.so",
|
68
|
+
"lib/gherkin_lexer_bg.so",
|
69
|
+
"lib/gherkin_lexer_cat.so",
|
70
|
+
"lib/gherkin_lexer_cs.so",
|
71
|
+
"lib/gherkin_lexer_cy.so",
|
72
|
+
"lib/gherkin_lexer_da.so",
|
73
|
+
"lib/gherkin_lexer_de.so",
|
74
|
+
"lib/gherkin_lexer_en.so",
|
75
|
+
"lib/gherkin_lexer_enau.so",
|
76
|
+
"lib/gherkin_lexer_enlol.so",
|
77
|
+
"lib/gherkin_lexer_entx.so",
|
78
|
+
"lib/gherkin_lexer_es.so",
|
79
|
+
"lib/gherkin_lexer_et.so",
|
80
|
+
"lib/gherkin_lexer_fi.so",
|
81
|
+
"lib/gherkin_lexer_fr.so",
|
82
|
+
"lib/gherkin_lexer_he.so",
|
83
|
+
"lib/gherkin_lexer_hr.so",
|
84
|
+
"lib/gherkin_lexer_hu.so",
|
85
|
+
"lib/gherkin_lexer_id.so",
|
86
|
+
"lib/gherkin_lexer_it.so",
|
87
|
+
"lib/gherkin_lexer_ja.so",
|
88
|
+
"lib/gherkin_lexer_ko.so",
|
89
|
+
"lib/gherkin_lexer_lt.so",
|
90
|
+
"lib/gherkin_lexer_lv.so",
|
91
|
+
"lib/gherkin_lexer_nl.so",
|
92
|
+
"lib/gherkin_lexer_no.so",
|
93
|
+
"lib/gherkin_lexer_pl.so",
|
94
|
+
"lib/gherkin_lexer_pt.so",
|
95
|
+
"lib/gherkin_lexer_ro.so",
|
96
|
+
"lib/gherkin_lexer_ro2.so",
|
97
|
+
"lib/gherkin_lexer_ru.so",
|
98
|
+
"lib/gherkin_lexer_se.so",
|
99
|
+
"lib/gherkin_lexer_sk.so",
|
100
|
+
"lib/gherkin_lexer_sr.so",
|
101
|
+
"lib/gherkin_lexer_srLatn.so",
|
102
|
+
"lib/gherkin_lexer_tr.so",
|
103
|
+
"lib/gherkin_lexer_uz.so",
|
104
|
+
"lib/gherkin_lexer_vi.so",
|
105
|
+
"lib/gherkin_lexer_zhCN.so",
|
106
|
+
"lib/gherkin_lexer_zhTW.so",
|
107
|
+
"nativegems.sh",
|
108
|
+
"ragel/i18n/.gitignore",
|
109
|
+
"ragel/lexer.c.rl.erb",
|
110
|
+
"ragel/lexer.java.rl.erb",
|
111
|
+
"ragel/lexer.rb.rl.erb",
|
112
|
+
"ragel/lexer_common.rl.erb",
|
113
|
+
"spec/gherkin/c_lexer_spec.rb",
|
114
|
+
"spec/gherkin/fixtures/1.feature",
|
115
|
+
"spec/gherkin/fixtures/complex.feature",
|
116
|
+
"spec/gherkin/fixtures/i18n_fr.feature",
|
117
|
+
"spec/gherkin/fixtures/i18n_no.feature",
|
118
|
+
"spec/gherkin/fixtures/i18n_zh-CN.feature",
|
119
|
+
"spec/gherkin/fixtures/simple.feature",
|
120
|
+
"spec/gherkin/fixtures/simple_with_comments.feature",
|
121
|
+
"spec/gherkin/fixtures/simple_with_tags.feature",
|
122
|
+
"spec/gherkin/i18n_spec.rb",
|
123
|
+
"spec/gherkin/java_lexer_spec.rb",
|
124
|
+
"spec/gherkin/parser_spec.rb",
|
125
|
+
"spec/gherkin/rb_lexer_spec.rb",
|
126
|
+
"spec/gherkin/sexp_recorder.rb",
|
127
|
+
"spec/gherkin/shared/lexer_spec.rb",
|
128
|
+
"spec/gherkin/shared/py_string_spec.rb",
|
129
|
+
"spec/gherkin/shared/table_spec.rb",
|
130
|
+
"spec/gherkin/shared/tags_spec.rb",
|
131
|
+
"spec/spec_helper.rb",
|
132
|
+
"tasks/bench.rake",
|
133
|
+
"tasks/bench/feature_builder.rb",
|
134
|
+
"tasks/bench/generated/.gitignore",
|
135
|
+
"tasks/bench/null_listener.rb",
|
136
|
+
"tasks/compile.rake",
|
137
|
+
"tasks/cucumber.rake",
|
138
|
+
"tasks/ragel_task.rb",
|
139
|
+
"tasks/rdoc.rake",
|
140
|
+
"tasks/rspec.rake"
|
141
|
+
]
|
142
|
+
s.homepage = %q{http://github.com/aslakhellesoy/gherkin}
|
143
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
144
|
+
s.require_paths = ["lib"]
|
145
|
+
s.rubygems_version = %q{1.3.5}
|
146
|
+
s.summary = %q{Fast Gherkin lexer}
|
147
|
+
s.test_files = [
|
148
|
+
"spec/gherkin/c_lexer_spec.rb",
|
149
|
+
"spec/gherkin/i18n_spec.rb",
|
150
|
+
"spec/gherkin/java_lexer_spec.rb",
|
151
|
+
"spec/gherkin/parser_spec.rb",
|
152
|
+
"spec/gherkin/rb_lexer_spec.rb",
|
153
|
+
"spec/gherkin/sexp_recorder.rb",
|
154
|
+
"spec/gherkin/shared/lexer_spec.rb",
|
155
|
+
"spec/gherkin/shared/py_string_spec.rb",
|
156
|
+
"spec/gherkin/shared/table_spec.rb",
|
157
|
+
"spec/gherkin/shared/tags_spec.rb",
|
158
|
+
"spec/spec_helper.rb"
|
159
|
+
]
|
160
|
+
|
161
|
+
if s.respond_to? :specification_version then
|
162
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
163
|
+
s.specification_version = 3
|
164
|
+
|
165
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
166
|
+
s.add_development_dependency(%q<rspec>, ["= 1.2.9"])
|
167
|
+
s.add_development_dependency(%q<cucumber>, ["= 0.4.4"])
|
168
|
+
s.add_development_dependency(%q<rake-compiler>, ["= 0.6.0"])
|
169
|
+
else
|
170
|
+
s.add_dependency(%q<rspec>, ["= 1.2.9"])
|
171
|
+
s.add_dependency(%q<cucumber>, ["= 0.4.4"])
|
172
|
+
s.add_dependency(%q<rake-compiler>, ["= 0.6.0"])
|
173
|
+
end
|
174
|
+
else
|
175
|
+
s.add_dependency(%q<rspec>, ["= 1.2.9"])
|
176
|
+
s.add_dependency(%q<cucumber>, ["= 0.4.4"])
|
177
|
+
s.add_dependency(%q<rake-compiler>, ["= 0.6.0"])
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
data/java/.gitignore
ADDED
data/java/Gherkin.iml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module relativePaths="true" type="JAVA_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
4
|
+
<exclude-output />
|
5
|
+
<content url="file://$MODULE_DIR$">
|
6
|
+
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
7
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
8
|
+
<excludeFolder url="file://$MODULE_DIR$/target" />
|
9
|
+
</content>
|
10
|
+
<orderEntry type="inheritedJdk" />
|
11
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
12
|
+
<orderEntry type="module-library" scope="TEST">
|
13
|
+
<library>
|
14
|
+
<CLASSES>
|
15
|
+
<root url="jar://$APPLICATION_HOME_DIR$/lib/junit-4.6.jar!/" />
|
16
|
+
</CLASSES>
|
17
|
+
<JAVADOC />
|
18
|
+
<SOURCES />
|
19
|
+
</library>
|
20
|
+
</orderEntry>
|
21
|
+
<orderEntry type="library" scope="TEST" name="Mockito" level="application" />
|
22
|
+
</component>
|
23
|
+
</module>
|
24
|
+
|
data/java/build.xml
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
<project name="Gherkin" default="jar" basedir=".">
|
2
|
+
<target name="compile" description="Compile">
|
3
|
+
<mkdir dir="${basedir}/target/classes"/>
|
4
|
+
<javac srcdir="src" destdir="target/classes" debug="on"/>
|
5
|
+
</target>
|
6
|
+
|
7
|
+
<target name="jar" description="Jar" depends="compile">
|
8
|
+
<jar destfile="${basedir}/../lib/gherkin.jar">
|
9
|
+
<fileset dir="${basedir}/target/classes" />
|
10
|
+
<fileset dir="${basedir}/../lib" includes="gherkin/parser/*.txt" />
|
11
|
+
</jar>
|
12
|
+
</target>
|
13
|
+
</project>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
package gherkin;
|
2
|
+
|
3
|
+
import java.io.IOException;
|
4
|
+
import java.io.InputStreamReader;
|
5
|
+
import java.io.Reader;
|
6
|
+
import java.util.List;
|
7
|
+
|
8
|
+
public class FixJava {
|
9
|
+
public static String join(List<String> strings, String separator) {
|
10
|
+
StringBuffer sb = new StringBuffer();
|
11
|
+
int i = 0;
|
12
|
+
for (String s : strings) {
|
13
|
+
if (i != 0) sb.append(separator);
|
14
|
+
sb.append(s);
|
15
|
+
i++;
|
16
|
+
}
|
17
|
+
return sb.toString();
|
18
|
+
}
|
19
|
+
|
20
|
+
public static String readResourceAsString(String filePath) throws IOException {
|
21
|
+
Reader machine = new InputStreamReader(FixJava.class.getResourceAsStream(filePath));
|
22
|
+
|
23
|
+
final char[] buffer = new char[0x10000];
|
24
|
+
StringBuilder out = new StringBuilder();
|
25
|
+
int read;
|
26
|
+
do {
|
27
|
+
read = machine.read(buffer, 0, buffer.length);
|
28
|
+
if (read > 0) {
|
29
|
+
out.append(buffer, 0, read);
|
30
|
+
}
|
31
|
+
} while (read >= 0);
|
32
|
+
return out.toString();
|
33
|
+
}
|
34
|
+
}
|