fix(formatter): keep inline comment cells together in ReplaceWithVAR - #1788
Open
Sanjays2402 wants to merge 1 commit into
Open
fix(formatter): keep inline comment cells together in ReplaceWithVAR#1788Sanjays2402 wants to merge 1 commit into
Sanjays2402 wants to merge 1 commit into
Conversation
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
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.
Closes #1715
Robot Framework tokenizes a single inline comment into one
COMMENTtoken per data cell, and only the first cell starts with#. WhenReplaceWithVARmoved a multi-cell comment above the generatedVAR, 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 totests/formatter/formatters/ReplaceWithVAR/test_formatter.py(parametrized overCreate DictionaryandCreate List); it fails on master and passes with the fix, and the fulltests/formattersuite stays green.This change was prepared with AI assistance; the regression test was run locally and fails without the fix.