gherkin 1.0.23-i386-mingw32 → 1.0.24-i386-mingw32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +5 -0
- data/VERSION.yml +1 -1
- data/ragel/lexer.c.rl.erb +1 -1
- data/ragel/lexer.java.rl.erb +2 -2
- data/ragel/lexer.rb.rl.erb +13 -9
- data/spec/gherkin/formatter/pretty_formatter_spec.rb +15 -9
- data/spec/gherkin/formatter/spaces.feature +9 -0
- data/spec/gherkin/formatter/tabs.feature +9 -0
- data/tasks/compile.rake +1 -1
- metadata +4 -3
- data/lib/gherkin/core_ext/array.rb +0 -5
data/History.txt
CHANGED
data/VERSION.yml
CHANGED
data/ragel/lexer.c.rl.erb
CHANGED
@@ -290,7 +290,7 @@ store_pystring_content(VALUE listener,
|
|
290
290
|
VALUE con = ENCODED_STR_NEW(at, length);
|
291
291
|
// Gherkin will crash gracefully if the string representation of start_col pushes the pattern past 32 characters
|
292
292
|
char pat[32];
|
293
|
-
snprintf(pat, 32, "^ {0,%d}", start_col);
|
293
|
+
snprintf(pat, 32, "^[\t ]{0,%d}", start_col);
|
294
294
|
VALUE re = rb_reg_regcomp(rb_str_new2(pat));
|
295
295
|
VALUE re2 = rb_reg_regcomp(rb_str_new2("\r\\Z"));
|
296
296
|
VALUE unescape_escaped_quotes = rb_reg_regcomp(rb_str_new2("\\\\\"\\\\\"\\\\\""));
|
data/ragel/lexer.java.rl.erb
CHANGED
@@ -29,7 +29,7 @@ public class <%= @i18n.underscored_iso_code.upcase %> implements Lexer {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
action store_pystring_content {
|
32
|
-
String con = unindent(startCol, substring(data, contentStart, nextKeywordStart-1).replaceFirst("(\\r?\\n)?( )*\\Z", "").replaceAll("\\\\\"\\\\\"\\\\\"", "\"\"\""));
|
32
|
+
String con = unindent(startCol, substring(data, contentStart, nextKeywordStart-1).replaceFirst("(\\r?\\n)?([\\t ])*\\Z", "").replaceAll("\\\\\"\\\\\"\\\\\"", "\"\"\""));
|
33
33
|
listener.pyString(con, currentLine);
|
34
34
|
}
|
35
35
|
|
@@ -198,7 +198,7 @@ public class <%= @i18n.underscored_iso_code.upcase %> implements Lexer {
|
|
198
198
|
}
|
199
199
|
|
200
200
|
private String unindent(int startCol, String text) {
|
201
|
-
return Pattern.compile("^ {0," + startCol + "}", Pattern.MULTILINE).matcher(text).replaceAll("");
|
201
|
+
return Pattern.compile("^[\t ]{0," + startCol + "}", Pattern.MULTILINE).matcher(text).replaceAll("");
|
202
202
|
}
|
203
203
|
|
204
204
|
private String currentLineContent(byte[] data, int lastNewline) {
|
data/ragel/lexer.rb.rl.erb
CHANGED
@@ -21,7 +21,7 @@ module Gherkin
|
|
21
21
|
}
|
22
22
|
|
23
23
|
action store_pystring_content {
|
24
|
-
con = unindent(@start_col, data[@content_start...@next_keyword_start-1]
|
24
|
+
con = unindent(@start_col, utf8_pack(data[@content_start...@next_keyword_start-1]).sub(/(\r?\n)?([\t ])*\Z/, '').gsub(/\\"\\"\\"/, '"""'))
|
25
25
|
@listener.py_string(con, @current_line)
|
26
26
|
}
|
27
27
|
|
@@ -56,18 +56,18 @@ module Gherkin
|
|
56
56
|
}
|
57
57
|
|
58
58
|
action store_step_content {
|
59
|
-
con = data[@content_start...p]
|
59
|
+
con = utf8_pack(data[@content_start...p]).strip
|
60
60
|
@listener.step(@keyword, con, @current_line)
|
61
61
|
}
|
62
62
|
|
63
63
|
action store_comment_content {
|
64
|
-
con = data[@content_start...p]
|
64
|
+
con = utf8_pack(data[@content_start...p]).strip
|
65
65
|
@listener.comment(con, @line_number)
|
66
66
|
@keyword_start = nil
|
67
67
|
}
|
68
68
|
|
69
69
|
action store_tag_content {
|
70
|
-
con = data[@content_start...p]
|
70
|
+
con = utf8_pack(data[@content_start...p]).strip
|
71
71
|
@listener.tag(con, @current_line)
|
72
72
|
@keyword_start = nil
|
73
73
|
}
|
@@ -85,7 +85,7 @@ module Gherkin
|
|
85
85
|
}
|
86
86
|
|
87
87
|
action end_keyword {
|
88
|
-
@keyword = data[@keyword_start...p]
|
88
|
+
@keyword = utf8_pack(data[@keyword_start...p]).sub(/:$/,'')
|
89
89
|
@keyword_start = nil
|
90
90
|
}
|
91
91
|
|
@@ -104,7 +104,7 @@ module Gherkin
|
|
104
104
|
}
|
105
105
|
|
106
106
|
action store_cell_content {
|
107
|
-
con = data[@content_start...p]
|
107
|
+
con = utf8_pack(data[@content_start...p]).strip
|
108
108
|
current_row << con
|
109
109
|
}
|
110
110
|
|
@@ -153,18 +153,22 @@ module Gherkin
|
|
153
153
|
end
|
154
154
|
|
155
155
|
def unindent(startcol, text)
|
156
|
-
text.gsub(/^ {0,#{startcol}}/, "")
|
156
|
+
text.gsub(/^[\t ]{0,#{startcol}}/, "")
|
157
157
|
end
|
158
158
|
|
159
159
|
def store_keyword_content(event, data, p, eof)
|
160
160
|
end_point = (!@next_keyword_start or (p == eof)) ? p : @next_keyword_start
|
161
|
-
con = yield data[@content_start...end_point]
|
161
|
+
con = yield utf8_pack(data[@content_start...end_point])
|
162
162
|
@listener.send(event, @keyword, con, @current_line)
|
163
163
|
end
|
164
164
|
|
165
165
|
def current_line_content(data, p)
|
166
166
|
rest = data[@last_newline..-1]
|
167
|
-
rest[0..rest.index(10)||-1]
|
167
|
+
utf8_pack(rest[0..rest.index(10)||-1]).strip
|
168
|
+
end
|
169
|
+
|
170
|
+
def utf8_pack(array)
|
171
|
+
(RUBY_VERSION =~ /^1\.9/) ? array.pack("c*").force_encoding("UTF-8") : array.pack("c*")
|
168
172
|
end
|
169
173
|
end
|
170
174
|
end
|
@@ -13,15 +13,17 @@ module Gherkin
|
|
13
13
|
actual.should == s
|
14
14
|
end
|
15
15
|
|
16
|
-
def assert_pretty(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
16
|
+
def assert_pretty(input, output=input)
|
17
|
+
[true, false].each do |force_ruby|
|
18
|
+
io = StringIO.new
|
19
|
+
l = PrettyFormatter.new(io, true)
|
20
|
+
parser = Gherkin::Parser::Parser.new(l, true, "root")
|
21
|
+
lexer = Gherkin::I18nLexer.new(parser, force_ruby)
|
22
|
+
lexer.scan(input)
|
23
|
+
io.rewind
|
24
|
+
actual = io.read
|
25
|
+
actual.should == output
|
26
|
+
end
|
25
27
|
end
|
26
28
|
|
27
29
|
before do
|
@@ -142,6 +144,10 @@ Feature: Feature Description
|
|
142
144
|
| Bed | They | are tired |
|
143
145
|
})
|
144
146
|
end
|
147
|
+
|
148
|
+
it "should preserve tabs" do
|
149
|
+
assert_pretty(IO.read(File.dirname(__FILE__) + '/tabs.feature'), IO.read(File.dirname(__FILE__) + '/spaces.feature'))
|
150
|
+
end
|
145
151
|
end
|
146
152
|
end
|
147
153
|
end
|
data/tasks/compile.rake
CHANGED
@@ -21,7 +21,7 @@ file 'lib/gherkin.jar' => Dir['java/src/main/java/**/*.java'] do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
rl_langs = ENV['RL_LANGS'] ? ENV['RL_LANGS'].split(',') : []
|
24
|
-
langs = Gherkin::I18n.all.select { |lang| rl_langs.empty? || rl_langs.include?(lang.
|
24
|
+
langs = Gherkin::I18n.all.select { |lang| rl_langs.empty? || rl_langs.include?(lang.iso_code) }
|
25
25
|
|
26
26
|
langs.each do |i18n|
|
27
27
|
java = RagelTask.new('java', i18n)
|
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
|
+
- 24
|
9
|
+
version: 1.0.24
|
10
10
|
platform: i386-mingw32
|
11
11
|
authors:
|
12
12
|
- Mike Sassak
|
@@ -198,7 +198,6 @@ files:
|
|
198
198
|
- lib/gherkin.rb
|
199
199
|
- lib/gherkin/c_lexer.rb
|
200
200
|
- lib/gherkin/cli/main.rb
|
201
|
-
- lib/gherkin/core_ext/array.rb
|
202
201
|
- lib/gherkin/csharp_lexer.rb
|
203
202
|
- lib/gherkin/formatter/argument.rb
|
204
203
|
- lib/gherkin/formatter/colors.rb
|
@@ -244,6 +243,8 @@ files:
|
|
244
243
|
- spec/gherkin/formatter/argument_spec.rb
|
245
244
|
- spec/gherkin/formatter/colors_spec.rb
|
246
245
|
- spec/gherkin/formatter/pretty_formatter_spec.rb
|
246
|
+
- spec/gherkin/formatter/spaces.feature
|
247
|
+
- spec/gherkin/formatter/tabs.feature
|
247
248
|
- spec/gherkin/i18n_lexer_spec.rb
|
248
249
|
- spec/gherkin/i18n_spec.rb
|
249
250
|
- spec/gherkin/java_lexer_spec.rb
|