cucumber-gherkin 9.2.0 → 10.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e89aea7a6edadf01a74a1ebbbf96b6f78f86607048295b9f90b7ce19f759ef6c
4
- data.tar.gz: 3a557a7ad81abf607bad3a8ca947283bd4c1169cd9c921b25b99e9b50194b4ac
3
+ metadata.gz: 01aa9e9322f0347200ffdc2e899c9ea4d70cde244d0781fb3d1d3db5dbbb1939
4
+ data.tar.gz: f7f687d566ad7a939243db783418a614629d39c0919bf95e6ba8b3c3846f9b2b
5
5
  SHA512:
6
- metadata.gz: b87ab0250281aaa2fd367df846860840a9586f25be0a3ef7d6ee46d667c5460fa144e658049ba860e906067dbdab7877d91dca7ebb1252fb5e15f8a50c861a83
7
- data.tar.gz: 9bf856638e88155bf950b3cb19171c91f28b9b9af79fc18b0dc5d595b8d1412a18013da3cd8e0f7ded3d7f01f8f95172bc8c7db98404dad8816bcfaf1ee10050
6
+ metadata.gz: 0d87ec9065139133f6462d8858725e68e918856a81d8c9c4d8b33877edb1a5c455bc35f52bde741b36794523da05899cee5bf0276ab476076b5175c51e068adf
7
+ data.tar.gz: 9cb328c9b31a3a964d3b2c62116f1c922329a894ab27bb2069179259130b4aa18a3308193dbafd298b1e46277e1a8afa67e36204d022e726023220eb52398fd1
@@ -37,8 +37,9 @@ module Gherkin
37
37
  cells = []
38
38
 
39
39
  self.split_table_cells(@trimmed_line_text) do |item, column|
40
- txt_trimmed_left = item.gsub(/^[ \t\n\v\f\r\u0085\u00A0]*/, '')
41
- txt_trimmed = txt_trimmed_left.gsub(/[ \t\n\v\f\r\u0085\u00A0]*$/, '')
40
+ # Keeps new lines
41
+ txt_trimmed_left = item.sub(/\A[ \t\v\f\r\u0085\u00A0]*/, '')
42
+ txt_trimmed = txt_trimmed_left.sub(/[ \t\v\f\r\u0085\u00A0]*\z/, '')
42
43
  cell_indent = item.length - txt_trimmed_left.length
43
44
  span = Span.new(@indent + column + cell_indent, txt_trimmed)
44
45
  cells.push(span)
@@ -81,15 +82,26 @@ module Gherkin
81
82
  end
82
83
 
83
84
  def tags
84
- column = @indent + 1;
85
- items = @trimmed_line_text.strip.split('@')
86
- items = items[1..-1] # ignore before the first @
87
- items.map do |item|
88
- length = item.length
89
- span = Span.new(column, '@' + item.strip)
90
- column += length + 1
91
- span
92
- end
85
+ uncommented_line = @trimmed_line_text.split(/\s#/,2)[0]
86
+ column = @indent + 1
87
+ items = uncommented_line.split('@')
88
+
89
+ tags = []
90
+ items.each { |untrimmed|
91
+ item = untrimmed.strip
92
+ if item.length == 0
93
+ next
94
+ end
95
+
96
+ unless item =~ /^\S+$/
97
+ location = {line: @line_number, column: column}
98
+ raise ParserException.new('A tag may not contain whitespace', location)
99
+ end
100
+
101
+ tags << Span.new(column, '@' + item)
102
+ column += untrimmed.length + 1
103
+ }
104
+ tags
93
105
  end
94
106
 
95
107
  class Span < Struct.new(:column, :text); end
@@ -80,7 +80,7 @@ module Gherkin
80
80
  if @active_doc_string_separator.nil?
81
81
  # open
82
82
  _match_DocStringSeparator(token, '"""', true) ||
83
- _match_DocStringSeparator(token, '```', true)
83
+ _match_DocStringSeparator(token, '```', true)
84
84
  else
85
85
  # close
86
86
  _match_DocStringSeparator(token, @active_doc_string_separator, false)
@@ -118,10 +118,10 @@ module Gherkin
118
118
 
119
119
  def match_StepLine(token)
120
120
  keywords = @dialect.given_keywords +
121
- @dialect.when_keywords +
122
- @dialect.then_keywords +
123
- @dialect.and_keywords +
124
- @dialect.but_keywords
121
+ @dialect.when_keywords +
122
+ @dialect.then_keywords +
123
+ @dialect.and_keywords +
124
+ @dialect.but_keywords
125
125
 
126
126
  keyword = keywords.detect { |k| token.line.start_with?(k) }
127
127
 
@@ -152,7 +152,7 @@ module Gherkin
152
152
  true
153
153
  end
154
154
 
155
- def set_token_matched(token, matched_type, text=nil, keyword=nil, indent=nil, items=[])
155
+ def set_token_matched(token, matched_type, text = nil, keyword = nil, indent = nil, items = [])
156
156
  token.matched_type = matched_type
157
157
  token.matched_text = text && text.chomp
158
158
  token.matched_keyword = keyword
@@ -163,7 +163,13 @@ module Gherkin
163
163
  end
164
164
 
165
165
  def unescape_docstring(text)
166
- @active_doc_string_separator ? text.gsub("\\\"\\\"\\\"", "\"\"\"") : text
166
+ if @active_doc_string_separator == "\"\"\""
167
+ text.gsub("\\\"\\\"\\\"", "\"\"\"")
168
+ elsif @active_doc_string_separator == "```"
169
+ text.gsub("\\`\\`\\`", "```")
170
+ else
171
+ text
172
+ end
167
173
  end
168
174
  end
169
175
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-gherkin
3
3
  version: !ruby/object:Gem::Version
4
- version: 9.2.0
4
+ version: 10.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gáspár Nagy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-01-22 00:00:00.000000000 Z
13
+ date: 2020-02-13 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cucumber-messages
@@ -18,20 +18,20 @@ dependencies:
18
18
  requirements:
19
19
  - - "~>"
20
20
  - !ruby/object:Gem::Version
21
- version: '9.0'
21
+ version: '10.0'
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
24
- version: 9.0.3
24
+ version: 10.0.1
25
25
  type: :runtime
26
26
  prerelease: false
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  requirements:
29
29
  - - "~>"
30
30
  - !ruby/object:Gem::Version
31
- version: '9.0'
31
+ version: '10.0'
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: 9.0.3
34
+ version: 10.0.1
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: rake
37
37
  requirement: !ruby/object:Gem::Requirement
@@ -156,7 +156,7 @@ rubyforge_project:
156
156
  rubygems_version: 2.7.6.2
157
157
  signing_key:
158
158
  specification_version: 4
159
- summary: cucumber-gherkin-9.2.0
159
+ summary: cucumber-gherkin-10.0.0
160
160
  test_files:
161
161
  - spec/gherkin/dialect_spec.rb
162
162
  - spec/gherkin/stream/parser_message_stream_spec.rb