Skip to content

Commit 5ed2972

Browse files
authored
[.NET] Prefer the longest step keyword (#405)
1 parent bf79ee8 commit 5ed2972

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This document is formatted according to the principles of [Keep A CHANGELOG](htt
1111
### Fixed
1212
- [cpp] Actually use the VERSION file ([#376](https://github.com/cucumber/gherkin/pull/376))
1313
- [Java] Prefer the longest step keyword ([#401](https://github.com/cucumber/gherkin/pull/401))
14+
- [.NET] Prefer the longest step keyword ([#405](https://github.com/cucumber/gherkin/pull/405))
1415
- [PHP] Prefer the longest step keyword ([#403](https://github.com/cucumber/gherkin/pull/403))
1516

1617
## [32.1.1] - 2025-04-11

dotnet/Gherkin/GherkinDialect.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ public class GherkinDialect(
3535
.Concat(andStepKeywords)
3636
.Concat(butStepKeywords)
3737
.Distinct()
38+
.OrderByDescending(x => x.Length) // To avoid conflicts when some keywords are prefixes of others, try the longest keywords first.
3839
.ToArray();
3940

4041
public IDictionary<string, StepKeywordType> StepKeywordTypes { get; } = new[] { new { Keyword = AsteriskKeyword, Type = StepKeywordType.Unknown } }

0 commit comments

Comments
 (0)