gherkin 1.0.22-java → 1.0.23-java
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -3
- data/Rakefile +1 -1
- data/VERSION.yml +1 -1
- data/lib/gherkin/formatter/pretty_formatter.rb +1 -1
- data/lib/gherkin/parser/{sexp.rb → event.rb} +1 -1
- data/lib/gherkin/parser/filter_listener.rb +31 -31
- data/ragel/lexer.java.rl.erb +2 -2
- data/spec/gherkin/formatter/pretty_formatter_spec.rb +5 -5
- data/spec/gherkin/sexp_recorder.rb +3 -0
- metadata +6 -6
data/History.txt
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 1.0.23 (2010-05-02)
|
2
|
+
|
3
|
+
=== Changed Features
|
4
|
+
* Java API now uses camelCased method names instead of underscored (more Java-like) (Aslak Hellesøy)
|
5
|
+
|
1
6
|
== 1.0.22 (2010-04-28)
|
2
7
|
|
3
8
|
=== Bugfixes
|
@@ -8,12 +13,12 @@
|
|
8
13
|
=== Bugfixes
|
9
14
|
* Fix compile warning on ruby 1.9.2dev (2009-07-18 trunk 24186) (#53 Aslak Hellesøy)
|
10
15
|
|
11
|
-
== 1.0.20
|
16
|
+
== 1.0.20 (2010-04-20)
|
12
17
|
|
13
18
|
=== Bugfixes
|
14
19
|
* The gherkin CLI is working again (Gregory Hnatiuk)
|
15
20
|
|
16
|
-
== 1.0.19
|
21
|
+
== 1.0.19 (2010-04-20)
|
17
22
|
|
18
23
|
=== New Features
|
19
24
|
* Works with JRuby 1.5.0.RC1 (Aslak Hellesøy)
|
@@ -21,7 +26,7 @@
|
|
21
26
|
=== Changed Features
|
22
27
|
* I18n.code_keywords now return And and But as well, making Cucumber StepDefs a little more flexible (Aslak Hellesøy)
|
23
28
|
|
24
|
-
== 1.0.18 (2010-04-
|
29
|
+
== 1.0.18 (2010-04-20)
|
25
30
|
|
26
31
|
=== Bugfixes
|
27
32
|
* Explicitly use UTF-8 encoding when scanning source with Java lexer. (Aslak Hellesøy)
|
data/Rakefile
CHANGED
@@ -20,7 +20,7 @@ begin
|
|
20
20
|
gem.executables = ["gherkin"]
|
21
21
|
gem.add_dependency "trollop", ">= 1.15"
|
22
22
|
gem.add_development_dependency "rspec", ">= 1.3.0"
|
23
|
-
gem.add_development_dependency "cucumber", ">= 0.7.0.beta.
|
23
|
+
gem.add_development_dependency "cucumber", ">= 0.7.0.beta.8"
|
24
24
|
gem.add_development_dependency "rake-compiler", ">= 0.7.0" unless defined?(JRUBY_VERSION)
|
25
25
|
|
26
26
|
gem.files -= FileList['ikvm/**/*']
|
data/VERSION.yml
CHANGED
@@ -53,7 +53,7 @@ module Gherkin
|
|
53
53
|
@io.puts "\n#{grab_comments!(' ')}#{grab_tags!(' ')} #{keyword}: #{indent(name, ' ')}"
|
54
54
|
end
|
55
55
|
|
56
|
-
def step(keyword, name, line, status=nil, arguments=nil, location=nil)
|
56
|
+
def step(keyword, name, line, status=nil, exception=nil, arguments=nil, location=nil)
|
57
57
|
flush_table
|
58
58
|
status_param = "#{status}_param" if status
|
59
59
|
name = Gherkin::Formatter::Argument.format(name, @format, (arguments || []))
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'gherkin/parser/
|
1
|
+
require 'gherkin/parser/event'
|
2
2
|
require 'gherkin/parser/tag_expression'
|
3
3
|
|
4
4
|
module Gherkin
|
@@ -34,32 +34,32 @@ module Gherkin
|
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
-
def method_missing(*
|
38
|
-
|
37
|
+
def method_missing(*event_args)
|
38
|
+
event = Event.new(event_args)
|
39
39
|
|
40
|
-
return
|
40
|
+
return event.replay(@listener) if no_filters?
|
41
41
|
|
42
|
-
case(
|
42
|
+
case(event.event)
|
43
43
|
when :tag
|
44
|
-
@meta_buffer <<
|
44
|
+
@meta_buffer << event
|
45
45
|
when :comment
|
46
|
-
@meta_buffer <<
|
46
|
+
@meta_buffer << event
|
47
47
|
when :feature
|
48
48
|
@feature_buffer = @meta_buffer
|
49
|
-
@feature_buffer <<
|
49
|
+
@feature_buffer << event
|
50
50
|
@feature_tags = extract_tags
|
51
51
|
@meta_buffer = []
|
52
|
-
@feature_ok = true if filter_match?(
|
52
|
+
@feature_ok = true if filter_match?(event)
|
53
53
|
when :background
|
54
54
|
@feature_buffer += @meta_buffer
|
55
|
-
@feature_buffer <<
|
55
|
+
@feature_buffer << event
|
56
56
|
@meta_buffer = []
|
57
57
|
@table_state = :background
|
58
|
-
@background_ok = true if filter_match?(
|
58
|
+
@background_ok = true if filter_match?(event)
|
59
59
|
when :scenario
|
60
60
|
replay_examples_rows_buffer
|
61
61
|
@scenario_buffer = @meta_buffer
|
62
|
-
@scenario_buffer <<
|
62
|
+
@scenario_buffer << event
|
63
63
|
@scenario_tags = extract_tags
|
64
64
|
@example_tags = []
|
65
65
|
@meta_buffer = []
|
@@ -70,7 +70,7 @@ module Gherkin
|
|
70
70
|
when :scenario_outline
|
71
71
|
replay_examples_rows_buffer
|
72
72
|
@scenario_buffer = @meta_buffer
|
73
|
-
@scenario_buffer <<
|
73
|
+
@scenario_buffer << event
|
74
74
|
@scenario_tags = extract_tags
|
75
75
|
@example_tags = []
|
76
76
|
@meta_buffer = []
|
@@ -81,7 +81,7 @@ module Gherkin
|
|
81
81
|
when :examples
|
82
82
|
replay_examples_rows_buffer
|
83
83
|
@examples_buffer = @meta_buffer
|
84
|
-
@examples_buffer <<
|
84
|
+
@examples_buffer << event
|
85
85
|
@example_tags = extract_tags
|
86
86
|
@meta_buffer = []
|
87
87
|
@examples_rows_buffer = []
|
@@ -91,11 +91,11 @@ module Gherkin
|
|
91
91
|
case(@table_state)
|
92
92
|
when :background
|
93
93
|
@feature_buffer += @meta_buffer
|
94
|
-
@feature_buffer <<
|
94
|
+
@feature_buffer << event
|
95
95
|
@meta_buffer = []
|
96
|
-
@background_ok = true if filter_match?(
|
96
|
+
@background_ok = true if filter_match?(event)
|
97
97
|
else
|
98
|
-
@scenario_buffer <<
|
98
|
+
@scenario_buffer << event
|
99
99
|
@scenario_ok ||= filter_match?(*@scenario_buffer)
|
100
100
|
@table_state = :step
|
101
101
|
end
|
@@ -103,32 +103,32 @@ module Gherkin
|
|
103
103
|
case(@table_state)
|
104
104
|
when :examples
|
105
105
|
unless header_row_already_buffered?
|
106
|
-
@examples_buffer <<
|
106
|
+
@examples_buffer << event
|
107
107
|
@examples_ok = true if filter_match?(*@examples_buffer)
|
108
108
|
else
|
109
|
-
@examples_rows_buffer <<
|
109
|
+
@examples_rows_buffer << event if @scenario_ok || @examples_ok || @feature_ok || filter_match?(event)
|
110
110
|
end
|
111
111
|
when :step
|
112
|
-
@scenario_buffer <<
|
112
|
+
@scenario_buffer << event
|
113
113
|
@scenario_ok ||= filter_match?(*@scenario_buffer)
|
114
114
|
when :background
|
115
115
|
@feature_buffer += @meta_buffer
|
116
|
-
@feature_buffer <<
|
116
|
+
@feature_buffer << event
|
117
117
|
@meta_buffer = []
|
118
118
|
else
|
119
119
|
raise "Bad table_state:#{@table_state.inspect}"
|
120
120
|
end
|
121
121
|
when :py_string
|
122
122
|
if @table_state == :background
|
123
|
-
@feature_buffer <<
|
123
|
+
@feature_buffer << event
|
124
124
|
@feature_ok ||= filter_match?(*@feature_buffer)
|
125
125
|
else
|
126
|
-
@scenario_buffer <<
|
126
|
+
@scenario_buffer << event
|
127
127
|
@scenario_ok ||= filter_match?(*@scenario_buffer)
|
128
128
|
end
|
129
129
|
when :eof
|
130
130
|
replay_examples_rows_buffer
|
131
|
-
|
131
|
+
event.replay(@listener)
|
132
132
|
return
|
133
133
|
else
|
134
134
|
super
|
@@ -160,9 +160,9 @@ module Gherkin
|
|
160
160
|
return @examples_buffer.any? && @examples_buffer[-1].event == :row
|
161
161
|
end
|
162
162
|
|
163
|
-
def filter_match?(*
|
163
|
+
def filter_match?(*events)
|
164
164
|
return false unless[:name_match?, :line_match?].include?(@filter_method)
|
165
|
-
|
165
|
+
events.detect{|event| event.__send__(@filter_method, @filters)}
|
166
166
|
end
|
167
167
|
|
168
168
|
def tag_match?
|
@@ -170,8 +170,8 @@ module Gherkin
|
|
170
170
|
end
|
171
171
|
|
172
172
|
def replay_buffers
|
173
|
-
(@feature_buffer + @scenario_buffer).each do |
|
174
|
-
|
173
|
+
(@feature_buffer + @scenario_buffer).each do |event|
|
174
|
+
event.replay(@listener)
|
175
175
|
end
|
176
176
|
@feature_buffer = []
|
177
177
|
@scenario_buffer = []
|
@@ -180,8 +180,8 @@ module Gherkin
|
|
180
180
|
def replay_examples_rows_buffer
|
181
181
|
if @examples_rows_buffer.any?
|
182
182
|
replay_buffers
|
183
|
-
(@examples_buffer + @examples_rows_buffer).each do |
|
184
|
-
|
183
|
+
(@examples_buffer + @examples_rows_buffer).each do |event|
|
184
|
+
event.replay(@listener)
|
185
185
|
end
|
186
186
|
@examples_rows_buffer = []
|
187
187
|
end
|
@@ -192,7 +192,7 @@ module Gherkin
|
|
192
192
|
end
|
193
193
|
|
194
194
|
def extract_tags
|
195
|
-
@meta_buffer.select { |
|
195
|
+
@meta_buffer.select { |event| event.event == :tag }.map { |event| event.keyword }
|
196
196
|
end
|
197
197
|
end
|
198
198
|
end
|
data/ragel/lexer.java.rl.erb
CHANGED
@@ -30,7 +30,7 @@ public class <%= @i18n.underscored_iso_code.upcase %> implements Lexer {
|
|
30
30
|
|
31
31
|
action store_pystring_content {
|
32
32
|
String con = unindent(startCol, substring(data, contentStart, nextKeywordStart-1).replaceFirst("(\\r?\\n)?( )*\\Z", "").replaceAll("\\\\\"\\\\\"\\\\\"", "\"\"\""));
|
33
|
-
listener.
|
33
|
+
listener.pyString(con, currentLine);
|
34
34
|
}
|
35
35
|
|
36
36
|
action store_feature_content {
|
@@ -56,7 +56,7 @@ public class <%= @i18n.underscored_iso_code.upcase %> implements Lexer {
|
|
56
56
|
|
57
57
|
action store_scenario_outline_content {
|
58
58
|
String con = multilineStrip(keywordContent(data, p, eof, nextKeywordStart, contentStart));
|
59
|
-
listener.
|
59
|
+
listener.scenarioOutline(keyword, con, currentLine);
|
60
60
|
if(nextKeywordStart != -1) p = nextKeywordStart - 1;
|
61
61
|
nextKeywordStart = -1;
|
62
62
|
}
|
@@ -36,8 +36,8 @@ module Gherkin
|
|
36
36
|
['When ', 'foo']
|
37
37
|
])
|
38
38
|
@l.scenario("Scenario", "The scenario", 4, "features/foo.feature:4")
|
39
|
-
@l.step("Given ", "some stuff", 5, nil, nil, "features/step_definitions/bar.rb:56")
|
40
|
-
@l.step("When ", "foo", 6, nil, nil, "features/step_definitions/bar.rb:96")
|
39
|
+
@l.step("Given ", "some stuff", 5, nil, nil, nil, "features/step_definitions/bar.rb:56")
|
40
|
+
@l.step("When ", "foo", 6, nil, nil, nil, "features/step_definitions/bar.rb:96")
|
41
41
|
|
42
42
|
assert_io(%{Feature: Hello
|
43
43
|
World
|
@@ -54,7 +54,7 @@ module Gherkin
|
|
54
54
|
['Given ', 'some stuff that is longer']
|
55
55
|
])
|
56
56
|
@l.scenario("Scenario", "The scenario", 4, "features/foo.feature:4")
|
57
|
-
@l.step("Given ", "some stuff that is longer", 5, nil, nil, "features/step_definitions/bar.rb:56")
|
57
|
+
@l.step("Given ", "some stuff that is longer", 5, nil, nil, nil, "features/step_definitions/bar.rb:56")
|
58
58
|
|
59
59
|
assert_io(%{Feature: Hello
|
60
60
|
World
|
@@ -70,7 +70,7 @@ module Gherkin
|
|
70
70
|
['Given ', 'some stuff that is longer']
|
71
71
|
])
|
72
72
|
@l.scenario("Scenario", "The scenario", 4, "features/foo.feature:4")
|
73
|
-
@l.step("Given ", "some stuff that is longer", 5, nil, nil, "features/step_definitions/bar.rb:56")
|
73
|
+
@l.step("Given ", "some stuff that is longer", 5, nil, nil, nil, "features/step_definitions/bar.rb:56")
|
74
74
|
|
75
75
|
assert_io(%{Feature: Hello
|
76
76
|
World
|
@@ -95,7 +95,7 @@ module Gherkin
|
|
95
95
|
|
96
96
|
it "should highlight arguments for regular steps" do
|
97
97
|
passed = defined?(JRUBY_VERSION) ? 'passed' : :passed
|
98
|
-
@l.step("Given ", "I have 999 cukes in my belly", 3, passed, [Gherkin::Formatter::Argument.new(7, '999')], nil)
|
98
|
+
@l.step("Given ", "I have 999 cukes in my belly", 3, passed, nil, [Gherkin::Formatter::Argument.new(7, '999')], nil)
|
99
99
|
assert_io(" Given I have 999 cukes in my belly\n")
|
100
100
|
end
|
101
101
|
|
@@ -5,6 +5,9 @@ module Gherkin
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def method_missing(event, *args)
|
8
|
+
event = :scenario_outline if event == :scenarioOutline # Special Java Lexer handling
|
9
|
+
event = :py_string if event == :pyString # Special Java Lexer handling
|
10
|
+
event = :syntax_error if event == :syntaxError # Special Java Lexer handling
|
8
11
|
args[0] = args[0].to_a if event == :row # Special JRuby handling
|
9
12
|
@sexps << [event] + args
|
10
13
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 23
|
9
|
+
version: 1.0.23
|
10
10
|
platform: java
|
11
11
|
authors:
|
12
12
|
- Mike Sassak
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-05-02 00:00:00 +02:00
|
20
20
|
default_executable: gherkin
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -58,8 +58,8 @@ dependencies:
|
|
58
58
|
- 7
|
59
59
|
- 0
|
60
60
|
- beta
|
61
|
-
-
|
62
|
-
version: 0.7.0.beta.
|
61
|
+
- 8
|
62
|
+
version: 0.7.0.beta.8
|
63
63
|
type: :development
|
64
64
|
version_requirements: *id003
|
65
65
|
description: A fast Gherkin lexer/parser based on the Ragel State Machine Compiler.
|
@@ -109,11 +109,11 @@ files:
|
|
109
109
|
- lib/gherkin/i18n.yml
|
110
110
|
- lib/gherkin/i18n_lexer.rb
|
111
111
|
- lib/gherkin/java_impl.rb
|
112
|
+
- lib/gherkin/parser/event.rb
|
112
113
|
- lib/gherkin/parser/filter_listener.rb
|
113
114
|
- lib/gherkin/parser/meta.txt
|
114
115
|
- lib/gherkin/parser/parser.rb
|
115
116
|
- lib/gherkin/parser/root.txt
|
116
|
-
- lib/gherkin/parser/sexp.rb
|
117
117
|
- lib/gherkin/parser/steps.txt
|
118
118
|
- lib/gherkin/parser/tag_expression.rb
|
119
119
|
- lib/gherkin/rb_lexer.rb
|