Skip to content

fix(formatter): keep inline comment cells together in ReplaceWithVAR - #1788

Open
Sanjays2402 wants to merge 1 commit into
MarketSquare:mainfrom
Sanjays2402:fix/replacewithvar-inline-comment-split
Open

fix(formatter): keep inline comment cells together in ReplaceWithVAR#1788
Sanjays2402 wants to merge 1 commit into
MarketSquare:mainfrom
Sanjays2402:fix/replacewithvar-inline-comment-split

Conversation

@Sanjays2402

Copy link
Copy Markdown
Contributor

Closes #1715

Robot Framework tokenizes a single inline comment into one COMMENT token per data cell, and only the first cell starts with #. When ReplaceWithVAR moved a multi-cell comment above the generated VAR, it emitted one comment line per token, so every cell after the first lost its # and became an executable line — silently breaking the suite at runtime.

Cells that do not start with # are now appended to the preceding comment, so the original comment stays on one line. Regression test added to tests/formatter/formatters/ReplaceWithVAR/test_formatter.py (parametrized over Create Dictionary and Create List); it fails on master and passes with the fix, and the full tests/formatter suite stays green.

This change was prepared with AI assistance; the regression test was run locally and fails without the fix.

Robot Framework tokenizes a single inline comment into one COMMENT token
per data cell, and only the first cell starts with '#'. When
ReplaceWithVAR moved a multi-cell comment above the generated VAR, it
emitted one comment line per token, so every cell after the first lost
its '#' and became an executable line - silently breaking the suite at
runtime.

Cells that do not start with '#' are now appended to the preceding
comment, so the original comment stays on one line.

Closes MarketSquare#1715
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.

ReplaceWithVAR silently corrupts inline comments on Create Dictionary / Create List

1 participant