From b437dc9fb154e32c28aca3889ebb85cb5301f8f7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 17 Dec 2025 23:54:12 +0000 Subject: [PATCH 1/5] Initial plan From b3ee9cad44a4d38a004ed01933b086c67ad786b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 00:05:07 +0000 Subject: [PATCH 2/5] Add test to demonstrate issue #964 - Data Table column ignored without closing delimiter Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com> --- .../Features/Parser/ParsingErrors.feature | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Tests/Reqnroll.Specs/Features/Parser/ParsingErrors.feature b/Tests/Reqnroll.Specs/Features/Parser/ParsingErrors.feature index de1fb17b1..21f7aec26 100644 --- a/Tests/Reqnroll.Specs/Features/Parser/ParsingErrors.feature +++ b/Tests/Reqnroll.Specs/Features/Parser/ParsingErrors.feature @@ -159,3 +159,18 @@ Scenario: Duplicated background | line | error | | 6 | got 'Background:' | +Scenario: Table header without trailing delimiter + Given there is a Gherkin file as + """ + Feature: Table without trailing delimiter + + Scenario: Table without trailing delimiter + Given a table + | EffectiveDate | InterestRate + | 1999-01-01 | 10.00 | + """ + When the file is parsed + Then the following errors are provided + | line | error | + | 6 | inconsistent cell count within the table | + From a4cf98071924a0d6457fe22e97c7a9c2006a8af8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 00:12:05 +0000 Subject: [PATCH 3/5] Update test to correctly demonstrate issue #964 - no warning when all rows missing trailing delimiter Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com> --- .../Features/Parser/ParsingErrors.feature | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Tests/Reqnroll.Specs/Features/Parser/ParsingErrors.feature b/Tests/Reqnroll.Specs/Features/Parser/ParsingErrors.feature index 21f7aec26..ced017f5e 100644 --- a/Tests/Reqnroll.Specs/Features/Parser/ParsingErrors.feature +++ b/Tests/Reqnroll.Specs/Features/Parser/ParsingErrors.feature @@ -159,7 +159,11 @@ Scenario: Duplicated background | line | error | | 6 | got 'Background:' | -Scenario: Table header without trailing delimiter +Scenario: Table without trailing delimiter on any row + # This test demonstrates issue #964: when all rows are missing the trailing pipe delimiter, + # the parser silently ignores the last column instead of reporting an error. + # Expected behavior: should report an error or warning about missing trailing delimiter + # Actual behavior: no error is reported, and the last column is silently ignored Given there is a Gherkin file as """ Feature: Table without trailing delimiter @@ -167,10 +171,8 @@ Scenario: Table header without trailing delimiter Scenario: Table without trailing delimiter Given a table | EffectiveDate | InterestRate - | 1999-01-01 | 10.00 | + | 1999-01-01 | 10.00 """ When the file is parsed - Then the following errors are provided - | line | error | - | 6 | inconsistent cell count within the table | + Then no parsing error is reported From a4655b3ca03a4895454a5c941c77d2dfbb533961 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 00:21:22 +0000 Subject: [PATCH 4/5] Add assertion to verify InterestRate column is ignored when trailing delimiter is missing Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com> --- .../Drivers/Parser/ParserDriver.cs | 25 +++++++++++++++++++ .../Features/Parser/ParsingErrors.feature | 3 +++ .../StepDefinitions/GherkinParserSteps.cs | 7 ++++++ 3 files changed, 35 insertions(+) diff --git a/Tests/Reqnroll.Specs/Drivers/Parser/ParserDriver.cs b/Tests/Reqnroll.Specs/Drivers/Parser/ParserDriver.cs index 584826d40..40fe44121 100644 --- a/Tests/Reqnroll.Specs/Drivers/Parser/ParserDriver.cs +++ b/Tests/Reqnroll.Specs/Drivers/Parser/ParserDriver.cs @@ -115,6 +115,31 @@ public void AssertErrors(List expectedErrors) } } + public void AssertTableHasColumns(params string[] expectedColumns) + { + ParsedDocument.Should().NotBeNull("The parsing was not successful"); + + var scenario = ParsedDocument.ReqnrollFeature.Children.FirstOrDefault() as Scenario; + scenario.Should().NotBeNull("No scenario found in the parsed document"); + + var step = scenario.Steps.FirstOrDefault(); + step.Should().NotBeNull("No step found in the scenario"); + + var table = step.Argument as Gherkin.Ast.DataTable; + table.Should().NotBeNull("No table argument found in the step"); + + var headerRow = table.Rows.FirstOrDefault(); + headerRow.Should().NotBeNull("Table has no rows"); + + var actualColumns = headerRow.Cells.Select(c => c.Value).ToList(); + + Console.WriteLine($"-> Expected columns: [{string.Join(", ", expectedColumns)}]"); + Console.WriteLine($"-> Actual columns: [{string.Join(", ", actualColumns)}]"); + + actualColumns.Should().BeEquivalentTo(expectedColumns, + "the parsed table should have the expected columns"); + } + public void SaveSerializedFeatureTo(string fileName) { ParsedDocument.Should().NotBeNull("The parsing was not successful"); diff --git a/Tests/Reqnroll.Specs/Features/Parser/ParsingErrors.feature b/Tests/Reqnroll.Specs/Features/Parser/ParsingErrors.feature index ced017f5e..a0f15db5f 100644 --- a/Tests/Reqnroll.Specs/Features/Parser/ParsingErrors.feature +++ b/Tests/Reqnroll.Specs/Features/Parser/ParsingErrors.feature @@ -175,4 +175,7 @@ Scenario: Table without trailing delimiter on any row """ When the file is parsed Then no parsing error is reported + And the parsed table has only the following columns + | column | + | EffectiveDate | diff --git a/Tests/Reqnroll.Specs/StepDefinitions/GherkinParserSteps.cs b/Tests/Reqnroll.Specs/StepDefinitions/GherkinParserSteps.cs index c14fad67c..d08e6c588 100644 --- a/Tests/Reqnroll.Specs/StepDefinitions/GherkinParserSteps.cs +++ b/Tests/Reqnroll.Specs/StepDefinitions/GherkinParserSteps.cs @@ -44,5 +44,12 @@ public void ThenTheTheFollowingErrorsAreProvided(List expectedErr { _parserDriver.AssertErrors(expectedErrors); } + + [Then(@"the parsed table has only the following columns")] + public void ThenTheParsedTableHasOnlyTheFollowingColumns(Table table) + { + var expectedColumns = table.Rows.Select(r => r["column"]).ToArray(); + _parserDriver.AssertTableHasColumns(expectedColumns); + } } } From a60bfea23948d3d9cbdb17965cf4534cdd04998a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 18 Dec 2025 00:23:18 +0000 Subject: [PATCH 5/5] Clean up code based on review feedback - remove debug output and improve type safety Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com> --- Tests/Reqnroll.Specs/Drivers/Parser/ParserDriver.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Tests/Reqnroll.Specs/Drivers/Parser/ParserDriver.cs b/Tests/Reqnroll.Specs/Drivers/Parser/ParserDriver.cs index 40fe44121..3d16e4e66 100644 --- a/Tests/Reqnroll.Specs/Drivers/Parser/ParserDriver.cs +++ b/Tests/Reqnroll.Specs/Drivers/Parser/ParserDriver.cs @@ -119,7 +119,7 @@ public void AssertTableHasColumns(params string[] expectedColumns) { ParsedDocument.Should().NotBeNull("The parsing was not successful"); - var scenario = ParsedDocument.ReqnrollFeature.Children.FirstOrDefault() as Scenario; + var scenario = ParsedDocument.ReqnrollFeature.Children.OfType().FirstOrDefault(); scenario.Should().NotBeNull("No scenario found in the parsed document"); var step = scenario.Steps.FirstOrDefault(); @@ -133,9 +133,6 @@ public void AssertTableHasColumns(params string[] expectedColumns) var actualColumns = headerRow.Cells.Select(c => c.Value).ToList(); - Console.WriteLine($"-> Expected columns: [{string.Join(", ", expectedColumns)}]"); - Console.WriteLine($"-> Actual columns: [{string.Join(", ", actualColumns)}]"); - actualColumns.Should().BeEquivalentTo(expectedColumns, "the parsed table should have the expected columns"); }