Skip to content

Commit 25f9087

Browse files
committed
internal/core/adt: add another test for issue 3826
Another reducer for the same test. Issue #3826 Signed-off-by: Marcel van Lohuizen <[email protected]> Change-Id: Ie641254eb64bee58a21b368b7d0ba82ac8d819cb Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1211845 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Daniel Martí <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
1 parent 3596477 commit 25f9087

File tree

1 file changed

+141
-0
lines changed

1 file changed

+141
-0
lines changed

Diff for: cue/testdata/definitions/root6.txtar

+141
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
-- in.cue --
2+
c: "foo"
3+
a: b: int
4+
#Schema
5+
#Schema: close({ a: b: int})
6+
7+
x: {
8+
c: "foo"
9+
a: b: int
10+
#Schema
11+
#Schema: close({ a: b: int})
12+
}
13+
-- out/eval/stats --
14+
Leaks: 4
15+
Freed: 14
16+
Reused: 9
17+
Allocs: 9
18+
Retain: 6
19+
20+
Unifications: 18
21+
Conjuncts: 32
22+
Disjuncts: 20
23+
-- out/evalalpha --
24+
Errors:
25+
c: field not allowed:
26+
./in.cue:1:1
27+
x: field not allowed:
28+
./in.cue:6:1
29+
30+
Result:
31+
(_|_){
32+
// [eval]
33+
c: (_|_){
34+
// [eval] c: field not allowed:
35+
// ./in.cue:1:1
36+
}
37+
a: (#struct){
38+
b: (int){ int }
39+
}
40+
#Schema: (#struct){
41+
a: (#struct){
42+
b: (int){ int }
43+
}
44+
}
45+
x: (_|_){
46+
// [eval] x: field not allowed:
47+
// ./in.cue:6:1
48+
c: (string){ "foo" }
49+
a: (#struct){
50+
b: (int){ int }
51+
}
52+
#Schema: (#struct){
53+
a: (#struct){
54+
b: (int){ int }
55+
}
56+
}
57+
}
58+
}
59+
-- diff/-out/evalalpha<==>+out/eval --
60+
diff old new
61+
--- old
62+
+++ new
63+
@@ -1,5 +1,16 @@
64+
-(#struct){
65+
- c: (string){ "foo" }
66+
+Errors:
67+
+c: field not allowed:
68+
+ ./in.cue:1:1
69+
+x: field not allowed:
70+
+ ./in.cue:6:1
71+
+
72+
+Result:
73+
+(_|_){
74+
+ // [eval]
75+
+ c: (_|_){
76+
+ // [eval] c: field not allowed:
77+
+ // ./in.cue:1:1
78+
+ }
79+
a: (#struct){
80+
b: (int){ int }
81+
}
82+
@@ -8,7 +19,9 @@
83+
b: (int){ int }
84+
}
85+
}
86+
- x: (#struct){
87+
+ x: (_|_){
88+
+ // [eval] x: field not allowed:
89+
+ // ./in.cue:6:1
90+
c: (string){ "foo" }
91+
a: (#struct){
92+
b: (int){ int }
93+
-- out/eval --
94+
(#struct){
95+
c: (string){ "foo" }
96+
a: (#struct){
97+
b: (int){ int }
98+
}
99+
#Schema: (#struct){
100+
a: (#struct){
101+
b: (int){ int }
102+
}
103+
}
104+
x: (#struct){
105+
c: (string){ "foo" }
106+
a: (#struct){
107+
b: (int){ int }
108+
}
109+
#Schema: (#struct){
110+
a: (#struct){
111+
b: (int){ int }
112+
}
113+
}
114+
}
115+
}
116+
-- out/compile --
117+
--- in.cue
118+
{
119+
c: "foo"
120+
a: {
121+
b: int
122+
}
123+
〈0;#Schema〉
124+
#Schema: close({
125+
a: {
126+
b: int
127+
}
128+
})
129+
x: {
130+
c: "foo"
131+
a: {
132+
b: int
133+
}
134+
〈0;#Schema〉
135+
#Schema: close({
136+
a: {
137+
b: int
138+
}
139+
})
140+
}
141+
}

0 commit comments

Comments
 (0)