Skip to content

Attach tables and doc strings to correct step#17

Merged
dcrockwell merged 9 commits intoTrustBound:developfrom
alvivi:main
Feb 3, 2026
Merged

Attach tables and doc strings to correct step#17
dcrockwell merged 9 commits intoTrustBound:developfrom
alvivi:main

Conversation

@alvivi
Copy link
Copy Markdown
Contributor

@alvivi alvivi commented Feb 2, 2026

Description

Fix parser bug where DataTables and DocStrings were attached to the wrong step when a scenario had multiple steps with tables. The parser was unnecessarily reversing the current_steps list twice when attaching arguments, but since steps are prepended during parsing, the most recent step is already at the head of the list.

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Test updates
  • Build/CI changes

Changes Made

  • Remove unnecessary double list.reverse in close_doc_string - work directly with head of current_steps
  • Remove unnecessary double list.reverse in add_data_table_row - same optimization
  • Add unit test multi_table_test.gleam that verifies multiple steps with tables are parsed correctly

Testing

  • Unit tests added/updated
  • All tests pass (make test)
  • Code formatted with gleam format
  • No compiler warnings

Documentation

  • HexDocs updated (if API changes)
  • README updated (if user-facing changes)
  • Examples updated (if relevant)

Breaking Changes

N/A

Checklist

  • I have read the contributing guidelines
  • I have read the coding standards
  • I have added tests that prove my fix is effective or that my feature works
  • All new and existing tests pass
  • I have commented my code, particularly in hard-to-understand areas
  • (N/A): I have made corresponding changes to the documentation

Screenshots (if applicable)

N/A

Additional Context

The bug manifested when parsing scenarios like:

Scenario: Two tables
  Given the first table:
    | A | B |
    | 1 | 2 |
  When the second table:
    | X | Y |
    | 3 | 4 |

Before the fix, both tables would be attached to the same step (or the wrong step), because list.reverse was being called on current_steps before finding "the last step", but steps are already stored with the most recent at the head (prepended during parsing).

dcrockwell and others added 9 commits December 1, 2025 04:10
Release 1.0.1 - Documentation improvements with tested code examples
Release 1.0.2 — Test skipping and CI exit codes
Release 1.0.3 — Cleaner test pipelines
Release v1.1.0 - Gherkin BDD, Test Filtering, JSON Reporter, and Per-Test Timing
Release: Dream Test v2 (new runner + reporting model)
@dcrockwell
Copy link
Copy Markdown
Contributor

Thanks for this! Looking at it now

@dcrockwell
Copy link
Copy Markdown
Contributor

Looks great! Fantastic work. Thank you!

@dcrockwell dcrockwell changed the base branch from main to develop February 3, 2026 02:10
@dcrockwell
Copy link
Copy Markdown
Contributor

I'm merging into develop, then I will release as 2.1.1 with attribution to you.

@dcrockwell dcrockwell merged commit 46c7744 into TrustBound:develop Feb 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants