Support escaped pipe (\|) in Gherkin table cells#81
Merged
mchaloupka merged 3 commits intofsprojects:masterfrom Mar 25, 2026
Merged
Support escaped pipe (\|) in Gherkin table cells#81mchaloupka merged 3 commits intofsprojects:masterfrom
mchaloupka merged 3 commits intofsprojects:masterfrom
Conversation
The Gherkin specification defines \| as an escape sequence for literal pipe characters within table cells. TickSpec previously split table rows on all | characters without handling escapes, making it impossible to include pipe characters in table data. Replace \| with a placeholder before splitting, then restore the literal | in the resulting cell values. This aligns TickSpec with the behavior of Cucumber, SpecFlow, and other Gherkin-based frameworks. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Scenarios.[2] is the third Examples row ("|leading"), not "before|after".
Fixed indices: 1 for "before|after", 4 for "a|b|c".
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Collaborator
|
Would you mind adding support for the full escaping logic as described?
E.g. the code currently rewrites |
Implement the complete escape logic per the Cucumber spec: - \\ → literal backslash - \| → literal pipe (not a cell delimiter) - \n → newline character Fix \\| being incorrectly treated as escaped pipe instead of escaped backslash followed by a cell delimiter.
Collaborator
|
Thanks for doing this work! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
\|escape sequences in Gherkin table cells, aligning TickSpec with the Gherkin specification and other frameworks (Cucumber, SpecFlow)TableRowLineparser now replaces\|with a placeholder before splitting on|, then restores literal|in the resulting cell values\|work exactly as beforeMotivation
Currently, it's impossible to include a literal pipe character (
|) in a Gherkin table cell value, since|is always treated as a column delimiter. The Gherkin spec defines\|as the standard escape for this, and other BDD frameworks support it. This is useful when testing values that naturally contain pipes (e.g., KQL queries, shell commands, regex patterns).Test plan
EscapedPipe.featurewith scenarios covering: no escapes (backward compat), single escaped pipe, leading/trailing pipes, multiple escaped pipes in one cell, and step tables with escaped pipesEscapedPipe_ParseLinestest verifying line-level parsing produces correctTableRowvalues with literal|EscapedPipe_ParseFeaturetest verifying full feature parsing resolves escaped pipes in both Scenario Outline parameters and step table cells🤖 Generated with Claude Code