Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruby: provide informative exception for trailing escapes in tables #244

Merged
merged 4 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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