-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/cue: add integration test for CUE_DEBUG=sortfields
It doesn't seem to work for evalv2; the following commit fixes that. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I64f39ee87a98d7f1fcda613001136291eb3e3c99 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1204654 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Matthew Sackman <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
- Loading branch information
Showing
1 changed file
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Test that CUE_DEBUG=sortfields is wired up correctly. | ||
|
||
# First, ensure that this debugging option is off by default. | ||
exec cue export input.cue | ||
cmp stdout export-unsorted.stdout | ||
|
||
# Turn it on and ensure it works as expected for various commands and encodings. | ||
# TODO: sortfields does not seem to work at all for evalv2. | ||
env CUE_DEBUG=sortfields | ||
|
||
exec cue export input.cue | ||
cmp stdout export.stdout | ||
|
||
exec cue export --out yaml input.cue | ||
cmp stdout export-yaml.stdout | ||
|
||
exec cue def input.cue | ||
cmp stdout def.stdout | ||
|
||
exec cue eval input.cue | ||
cmp stdout eval.stdout | ||
|
||
# Just to double check, ensure it also works for evalv3. | ||
env CUE_EXPERIMENT=evalv3 | ||
exec cue export input.cue | ||
cmp stdout export-evalv3.stdout | ||
|
||
-- input.cue -- | ||
c: true | ||
b: { | ||
x: true | ||
z: true | ||
} | ||
a: true | ||
b: y: true | ||
-- export-unsorted.stdout -- | ||
{ | ||
"c": true, | ||
"b": { | ||
"x": true, | ||
"y": true, | ||
"z": true | ||
}, | ||
"a": true | ||
} | ||
-- export.stdout -- | ||
{ | ||
"c": true, | ||
"b": { | ||
"x": true, | ||
"y": true, | ||
"z": true | ||
}, | ||
"a": true | ||
} | ||
-- export-evalv3.stdout -- | ||
{ | ||
"a": true, | ||
"b": { | ||
"x": true, | ||
"y": true, | ||
"z": true | ||
}, | ||
"c": true | ||
} | ||
-- export-yaml.stdout -- | ||
c: true | ||
b: | ||
x: true | ||
"y": true | ||
z: true | ||
a: true | ||
-- def.stdout -- | ||
c: true | ||
b: { | ||
x: true | ||
y: true | ||
z: true | ||
} | ||
a: true | ||
-- eval.stdout -- | ||
c: true | ||
b: { | ||
x: true | ||
y: true | ||
z: true | ||
} | ||
a: true |