File tree Expand file tree Collapse file tree 3 files changed +33
-8
lines changed
cmd/cue/cmd/testdata/script Expand file tree Collapse file tree 3 files changed +33
-8
lines changed Original file line number Diff line number Diff line change
1
+ #Issue 1304
2
+
3
+ ! cue export --out json x.cue
4
+ cmp stdout expect_stdout_json
5
+ cmp stderr expect_stderr_json
6
+
7
+ ! cue export --out cue x.cue
8
+ cmp stdout expect_stdout_cue
9
+ cmp stderr expect_stderr_cue
10
+
11
+ ! cue export --out yaml x.cue
12
+ cmp stdout expect_stdout_yaml
13
+ cmp stderr expect_stderr_yaml
14
+
15
+ -- x.cue --
16
+ toto: value: *_|_ | (*"toto" | string)
17
+
18
+ -- expect_stdout_cue --
19
+ -- expect_stderr_cue --
20
+ toto.value: incomplete value "toto" | string
21
+ -- expect_stdout_json --
22
+ -- expect_stderr_json --
23
+ toto.value: incomplete value "toto" | string
24
+ -- expect_stdout_yaml --
25
+ -- expect_stderr_yaml --
26
+ toto.value: incomplete value "toto" | string
Original file line number Diff line number Diff line change @@ -1562,14 +1562,20 @@ func TestDefaults(t *testing.T) {
1562
1562
ok : true ,
1563
1563
}, {
1564
1564
value : `{a:1}&{b:2}` ,
1565
- def : `( {a:1} & { b:2}) ` ,
1565
+ def : `{a:1, b:2}` ,
1566
1566
val : `` ,
1567
1567
ok : false ,
1568
+ }, {
1569
+ value : `*_|_ | (*"x" | string)` ,
1570
+ def : `"x" | string` ,
1571
+ val : `"x"|string` ,
1572
+ ok : false ,
1568
1573
}}
1569
1574
for _ , tc := range testCases {
1570
1575
t .Run (tc .value , func (t * testing.T ) {
1571
1576
v := getInstance (t , "a: " + tc .value ).Lookup ("a" )
1572
1577
1578
+ v = v .Eval ()
1573
1579
d , ok := v .Default ()
1574
1580
if ok != tc .ok {
1575
1581
t .Errorf ("hasDefault: got %v; want %v" , ok , tc .ok )
Original file line number Diff line number Diff line change @@ -54,13 +54,6 @@ func (v *Vertex) Default() *Vertex {
54
54
55
55
switch d .NumDefaults {
56
56
case 0 :
57
- if d .HasDefaults {
58
- v = & Vertex {
59
- Parent : v .Parent ,
60
- status : Finalized ,
61
- BaseValue : & Bottom {},
62
- }
63
- }
64
57
return v
65
58
case 1 :
66
59
w = d .Values [0 ]
You can’t perform that action at this time.
0 commit comments