Skip to content

Commit 17317ca

Browse files
committed
cue/format: add test case for formatting empty and near-empty files
They all behave as expected, but as I investigated the report at https://cuelang.org/issue/3895 I noticed we lacked some test cases. Note that the empty.input file has zero bytes, and empty.golden has one, which is just a newline. Formatting empty CUE source files as one newline seems reasonable given that we always end CUE source with one newline. Modern text editors seem to do the same with empty files. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I58caeb2f2709a84adfd0f2aa223a8068e5de72bb Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1214303 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Paul Jolly <[email protected]>
1 parent 4b194d7 commit 17317ca

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

cue/format/testdata/comments.txtar

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
simplify
22

3+
-- empty.input --
4+
-- empty.golden --
5+
36
-- comments.input --
47
// Package line 1 group 1
58
// Package line 2 group 1

cue/format/testdata/imports.txtar

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
sort-imports
22

3+
-- pkgonly.input --
4+
package foo
5+
-- pkgonly.golden --
6+
package foo
7+
-- attronly.input --
8+
@attr(foo)
9+
-- attronly.golden --
10+
@attr(foo)
11+
-- importonly.input --
12+
import "foo"
13+
-- importonly.golden --
14+
import "foo"
315
-- imports.input --
416
package foo
517

0 commit comments

Comments
 (0)