Skip to content

Commit 4d505e0

Browse files
committed
cmd/cue: confirm issues 1152 and 1153 are fixed
Fixes #1152 Fixes #1153 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: Ida2ba39e361621dba1c5a14bfa45bae004de893c Signed-off-by: Marcel van Lohuizen <[email protected]> Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/528037 Reviewed-by: Marcel van Lohuizen <[email protected]> Unity-Result: CUEcueckoo <[email protected]> TryBot-Result: CUEcueckoo <[email protected]>
1 parent eb53c4e commit 4d505e0

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#Issue 1153
2+
#Issue 1152
3+
4+
# Default export mode
5+
! exec cue export x.cue
6+
stderr 'incomplete'
7+
8+
# JSON
9+
! exec cue export --out json x.cue
10+
stderr 'incomplete'
11+
12+
# Yaml
13+
! exec cue export --out yaml x.cue
14+
stderr 'incomplete'
15+
16+
# CUE data
17+
! exec cue export --out cue x.cue
18+
stderr 'incomplete'
19+
20+
# Concrete
21+
! exec cue eval -c x.cue
22+
stderr 'incomplete'
23+
24+
# CUE
25+
exec cue eval --out cue x.cue
26+
cmp stdout expect-cue
27+
28+
-- x.cue --
29+
package foo
30+
31+
#SomeBaseType: {
32+
"a" | "b"
33+
#AUTO: "z"
34+
}
35+
36+
V1: ("x" | "y") | *"z"
37+
V2: ("x" | "y") | *#SomeBaseType.#AUTO
38+
39+
-- expect-cue --
40+
#SomeBaseType: {
41+
"a"
42+
#AUTO: "z"
43+
} | {
44+
"b"
45+
#AUTO: "z"
46+
}
47+
V1: "z"
48+
V2: "x" | "y"

cue/types_test.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2643,6 +2643,19 @@ func TestMarshalJSON(t *testing.T) {
26432643
y: _
26442644
`,
26452645
err: `x: cannot range over y (incomplete type _)`,
2646+
}, {
2647+
value: `
2648+
package foo
2649+
2650+
#SomeBaseType: {
2651+
"a" | "b"
2652+
#AUTO: "z"
2653+
}
2654+
2655+
V1: ("x" | "y") | *"z"
2656+
V2: ("x" | "y") | *#SomeBaseType.#AUTO
2657+
`,
2658+
err: "cue: marshal error: V2: cannot convert incomplete value \"|((string){ \\\"x\\\" }, (string){ \\\"y\\\" })\" to JSON",
26462659
}}
26472660
for i, tc := range testCases {
26482661
t.Run(fmt.Sprintf("%d/%v", i, tc.value), func(t *testing.T) {

0 commit comments

Comments
 (0)