Skip to content

Commit

Permalink
ruby: provide informative exception for trailing escapes in tables (#244
Browse files Browse the repository at this point in the history
)
  • Loading branch information
mpkorstanje authored Jul 8, 2024
1 parent 10701cd commit 20e23cb
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt

## [Unreleased]
### Fixed
- [Ruby] Provide informative exception for trailing escapes in tables ([#244](https://github.com/cucumber/gherkin/pull/244))
- [Python] Provide informative exception for trailing escapes in tables ([#241](https://github.com/cucumber/gherkin/pull/241))
- (i18n) Provide trailing space in Irish step keywords ([#243](https://github.com/cucumber/gherkin/pull/243))
- (i18n) Provide trailing space in Korean step keywords ([#254](https://github.com/cucumber/gherkin/pull/254))
Expand Down
2 changes: 1 addition & 1 deletion ruby/lib/gherkin/gherkin_line.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def split_table_cells(row)
cell = ''
start_col = col + 1
elsif char == '\\'
char = row[col]
char = row[col] || ''
col += 1
if char == 'n'
cell += "\n"
Expand Down
4 changes: 4 additions & 0 deletions ruby/spec/gherkin/gherkin_line_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,9 @@ def cells_text(line)
it 'does not drop white spaces inside a cell' do
expect(cells_text("| foo()\n bar\nbaz |")).to eq(["foo()\n bar\nbaz"])
end

it 'trailing escapes are ignored' do
expect(cells_text("| a |\\")).to eq(['a'])
end
end
end

0 comments on commit 20e23cb

Please sign in to comment.