Skip to content

Commit 452fbae

Browse files
committed
cue/format: add test for issue #4238
The formatter incorrectly places commas after inline comments in list elements with ellipsis, e.g. `...string // comment` becomes `...string // comment,` instead of `...string, // comment`. For #4238 Signed-off-by: Daniel Martí <[email protected]> Change-Id: I6b1b887195fce3255d88090fc4eb930f446f2f69 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1229756 Reviewed-by: Matthew Sackman <[email protected]> TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
1 parent beae55b commit 452fbae

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

cue/format/testdata/comments.txtar

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,14 @@ foo: [
173173
[string]: _ // comment
174174
}
175175
}
176+
177+
// issue #4238
178+
[string]: [
179+
...string // inline comment without a comma
180+
]
181+
[string]: [
182+
...string, // inline comment with a comma
183+
]
176184
-- out/format/comments.golden --
177185
// Package line 1 group 1
178186
// Package line 2 group 1
@@ -332,6 +340,14 @@ foo: [
332340

333341
// an ellipsis
334342
}
343+
344+
// issue #4238
345+
[string]: [
346+
...string // inline comment without a comma,
347+
]
348+
[string]: [
349+
...string // inline comment with a comma,
350+
]
335351
-- comment_alone.input --
336352
// Just one comment on its own.
337353
-- out/format/comment_alone.golden --

0 commit comments

Comments
 (0)