Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/cue/cmd: avoid roundtrip when printing non-CUE in eval
Fixes #986 Change-Id: I85961ab2fc23828ad44814479e7057723aed03de Reviewed-on: https://cue-review.googlesource.com/c/cue/+/9862 Reviewed-by: CUE cueckoo <cueckoo@gmail.com> Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
- Loading branch information
Showing
2 changed files
with
51 additions
and
6 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
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,36 @@ | ||
|
||
# Hidden values are dropped when outputting CUE. This is fine in eval for | ||
# debugging, but not when the final result needs to be compiled again to be | ||
# converted to another format. | ||
|
||
cue eval in.cue --out yaml | ||
cmp stdout expect-stdout | ||
|
||
-- in.cue -- | ||
#Foo: { | ||
a: string | ||
b: string | ||
ab: "\(a)\(b)" | ||
} | ||
|
||
{ | ||
a: "aaa" | ||
b: "bbb" | ||
} & #Foo | ||
|
||
#Bar: { | ||
_c: string | ||
_d: string | ||
cd: "\(_c)\(_d)" | ||
} | ||
|
||
{ | ||
_c: "ccc" | ||
_d: "ddd" | ||
} & #Bar | ||
|
||
-- expect-stdout -- | ||
a: aaa | ||
b: bbb | ||
ab: aaabbb | ||
cd: cccddd |