internal/core/compile: reenable disabled tests
Change-Id: Ibfa45c676981e955d942cc80b8ae7927e0977195
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/8787
Reviewed-by: Paul Jolly <paul@myitcv.org.uk>
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cue/testdata/export/020.txtar b/cue/testdata/export/020.txtar
index 5659d63..f9b75c2 100644
--- a/cue/testdata/export/020.txtar
+++ b/cue/testdata/export/020.txtar
@@ -19,3 +19,11 @@
a: (string){ "" }
b: (int){ 0 }
}
+-- out/compile --
+--- in.cue
+{
+ {
+ a: ""
+ b: len(〈0;a〉)
+ }
+}
diff --git a/cue/testdata/fulleval/026_dont_convert_incomplete_errors_to_non-incomplete.txtar b/cue/testdata/fulleval/026_dont_convert_incomplete_errors_to_non-incomplete.txtar
index 121daaf..150c352 100644
--- a/cue/testdata/fulleval/026_dont_convert_incomplete_errors_to_non-incomplete.txtar
+++ b/cue/testdata/fulleval/026_dont_convert_incomplete_errors_to_non-incomplete.txtar
@@ -94,3 +94,24 @@
num: (number){ <4 }
is: (bool){ bool }
}
+-- out/compile --
+--- in.cue
+{
+ n1: {
+ min: <〈0;max〉
+ max: >〈0;min〉
+ }
+ n2: -〈0;num〉
+ n3: +〈0;num〉
+ n4: (〈0;num〉 + 〈0;num〉)
+ n5: (〈0;num〉 - 〈0;num〉)
+ n6: (〈0;num〉 * 〈0;num〉)
+ n7: (〈0;num〉 / 〈0;num〉)
+ b1: !〈0;is〉
+ s1: "\(〈0;str〉)"
+ s2: 〈import;strings〉.ContainsAny("dd")
+ s3: 〈import;strings〉.ContainsAny(〈0;str〉, "dd")
+ str: string
+ num: <4
+ is: bool
+}
diff --git a/cue/testdata/fulleval/027_len_of_incomplete_types.txtar b/cue/testdata/fulleval/027_len_of_incomplete_types.txtar
index 5b2fc83..1d183db 100644
--- a/cue/testdata/fulleval/027_len_of_incomplete_types.txtar
+++ b/cue/testdata/fulleval/027_len_of_incomplete_types.txtar
@@ -57,3 +57,36 @@
v9: (int){ 4 }
v10: (int){ 0 }
}
+-- out/compile --
+--- in.cue
+{
+ args: (*[]|[
+ ...string,
+ ])
+ v1: len(〈0;args〉)
+ v2: len([])
+ v3: len({})
+ v4: len({
+ a: 3
+ })
+ v5: len(({
+ a: 3
+ }|{
+ a: 4
+ }))
+ v6: len(('sf'|'dd'))
+ v7: len(([
+ 2,
+ ]|*[
+ 1,
+ 2,
+ ]))
+ v8: len(([
+ 2,
+ ]|[
+ 1,
+ 2,
+ ]))
+ v9: len("😂")
+ v10: len("")
+}
diff --git a/cue/testdata/fulleval/032_or_builtin_should_not_fail_on_non-concrete_empty_list.txtar b/cue/testdata/fulleval/032_or_builtin_should_not_fail_on_non-concrete_empty_list.txtar
index 1a44031..fd0e7b3 100644
--- a/cue/testdata/fulleval/032_or_builtin_should_not_fail_on_non-concrete_empty_list.txtar
+++ b/cue/testdata/fulleval/032_or_builtin_should_not_fail_on_non-concrete_empty_list.txtar
@@ -59,3 +59,22 @@
#JobID: (string){ "foo" }
}
}
+-- out/compile --
+--- in.cue
+{
+ #Workflow: {
+ jobs: {
+ [string]: {}
+ }
+ #JobID: or([
+ for k, _ in 〈0;jobs〉 {
+ 〈1;k〉
+ },
+ ])
+ }
+ foo: (〈0;#Workflow〉 & {
+ jobs: {
+ foo: {}
+ }
+ })
+}
diff --git "a/cue/testdata/fulleval/044_Issue_\043178.txtar" "b/cue/testdata/fulleval/044_Issue_\043178.txtar"
index 6738257..7819fe1 100644
--- "a/cue/testdata/fulleval/044_Issue_\043178.txtar"
+++ "b/cue/testdata/fulleval/044_Issue_\043178.txtar"
@@ -35,3 +35,11 @@
// [incomplete] error in call to encoding/hex.EncodedLen: non-concrete value int
}
}
+-- out/compile --
+--- in.cue
+{
+ foo: 〈import;"encoding/csv"〉.Decode(〈0;data〉)
+ data: bytes
+ len: int
+ bar: 〈import;"encoding/hex"〉.EncodedLen(〈0;len〉)
+}
diff --git a/cue/testdata/fulleval/048_dont_pass_incomplete_values_to_builtins.txtar b/cue/testdata/fulleval/048_dont_pass_incomplete_values_to_builtins.txtar
index 2dbf144..1443862 100644
--- a/cue/testdata/fulleval/048_dont_pass_incomplete_values_to_builtins.txtar
+++ b/cue/testdata/fulleval/048_dont_pass_incomplete_values_to_builtins.txtar
@@ -22,3 +22,9 @@
// ./in.cue:4:8
}
}
+-- out/compile --
+--- in.cue
+{
+ input: string
+ foo: 〈import;"encoding/json"〉.Marshal(〈0;input〉)
+}
diff --git a/cue/testdata/fulleval/049_alias_reuse_in_nested_scope.txtar b/cue/testdata/fulleval/049_alias_reuse_in_nested_scope.txtar
index 240a8b2..38c5889 100644
--- a/cue/testdata/fulleval/049_alias_reuse_in_nested_scope.txtar
+++ b/cue/testdata/fulleval/049_alias_reuse_in_nested_scope.txtar
@@ -92,3 +92,31 @@
}
}
}
+-- out/compile --
+--- in.cue
+{
+ #Foo: {
+ connection: {
+ [〈1;let X〉]: 〈1;let X〉
+ }
+ }
+ #A: {
+ foo: "key"
+ a: {
+ foo: {
+ [〈2;let X〉]: 〈2;let X〉
+ }
+ }
+ }
+ #B: {
+ foo: string
+ a: {
+ foo: {
+ [〈2;let X〉]: 〈2;let X〉
+ }
+ }
+ }
+ b: (〈0;#B〉 & {
+ foo: "key"
+ })
+}
diff --git a/cue/testdata/fulleval/050_json_Marshaling_detects_incomplete.txtar b/cue/testdata/fulleval/050_json_Marshaling_detects_incomplete.txtar
index f8f2f4e..1856363 100644
--- a/cue/testdata/fulleval/050_json_Marshaling_detects_incomplete.txtar
+++ b/cue/testdata/fulleval/050_json_Marshaling_detects_incomplete.txtar
@@ -39,3 +39,15 @@
// ./in.cue:5:20
}
}
+-- out/compile --
+--- in.cue
+{
+ a: 〈import;"encoding/json"〉.Marshal({
+ a: string
+ })
+ foo: {
+ a: 3
+ b: 〈1;foo〉.c
+ }
+ b: 〈import;"encoding/json"〉.Marshal(〈0;foo〉)
+}
diff --git a/cue/testdata/fulleval/051_detectIncompleteYAML.txtar b/cue/testdata/fulleval/051_detectIncompleteYAML.txtar
index b9f6f6e..f6d5d8d 100644
--- a/cue/testdata/fulleval/051_detectIncompleteYAML.txtar
+++ b/cue/testdata/fulleval/051_detectIncompleteYAML.txtar
@@ -99,3 +99,24 @@
}
}
}
+-- out/compile --
+--- in.cue
+{
+ #Spec: {
+ _vars: {
+ something: string
+ }
+ data: {
+ #foo: {
+ use: 〈2;_vars〉.something
+ }
+ baz: 〈import;"encoding/yaml"〉.Marshal(〈1;_vars〉.something)
+ foobar: 〈import;"encoding/yaml"〉.Marshal(〈0;#foo〉)
+ }
+ }
+ Val: (〈0;#Spec〉 & {
+ _vars: {
+ something: "var-string"
+ }
+ })
+}
diff --git a/cue/testdata/fulleval/052_detectIncompleteJSON.txtar b/cue/testdata/fulleval/052_detectIncompleteJSON.txtar
index 188a756..9996182 100644
--- a/cue/testdata/fulleval/052_detectIncompleteJSON.txtar
+++ b/cue/testdata/fulleval/052_detectIncompleteJSON.txtar
@@ -90,3 +90,24 @@
}
}
}
+-- out/compile --
+--- in.cue
+{
+ #Spec: {
+ _vars: {
+ something: string
+ }
+ data: {
+ #foo: {
+ use: 〈2;_vars〉.something
+ }
+ baz: 〈import;"encoding/json"〉.Marshal(〈1;_vars〉.something)
+ foobar: 〈import;"encoding/json"〉.Marshal(〈0;#foo〉)
+ }
+ }
+ Val: (〈0;#Spec〉 & {
+ _vars: {
+ something: "var-string"
+ }
+ })
+}
diff --git a/cue/testdata/fulleval/053_issue312.txtar b/cue/testdata/fulleval/053_issue312.txtar
index 85a5bf0..3671fbd 100644
--- a/cue/testdata/fulleval/053_issue312.txtar
+++ b/cue/testdata/fulleval/053_issue312.txtar
@@ -24,3 +24,14 @@
(struct){ |(*(#struct){
}, (struct){
}) }
+-- out/compile --
+--- in.cue
+{
+ for _, x in [
+ 1,
+ ] {
+ (*close({})|{
+ [_]: null
+ })
+ }
+}
diff --git a/cue/testdata/fulleval/056_issue314.txtar b/cue/testdata/fulleval/056_issue314.txtar
index 227a0dd..2df1a8b 100644
--- a/cue/testdata/fulleval/056_issue314.txtar
+++ b/cue/testdata/fulleval/056_issue314.txtar
@@ -101,3 +101,29 @@
}
}
}
+-- out/compile --
+--- in.cue
+{
+ x: {
+ s: "myname"
+ 〈1;#T〉
+ }
+ #T: {
+ s: string
+ out: 〈import;"text/template"〉.Execute("{{.s}}", {
+ s: 〈1;s〉
+ })
+ }
+ #V: {
+ s: string
+ out: 〈import;"encoding/json"〉.Marshal({
+ s: 〈1;s〉
+ })
+ }
+ #U: {
+ s: string
+ out: 〈import;"encoding/yaml"〉.Marshal({
+ s: 〈1;s〉
+ })
+ }
+}
diff --git a/cue/testdata/resolve/013_custom_validators.txtar b/cue/testdata/resolve/013_custom_validators.txtar
index ae7c1d2..4ec1f5c 100644
--- a/cue/testdata/resolve/013_custom_validators.txtar
+++ b/cue/testdata/resolve/013_custom_validators.txtar
@@ -38,3 +38,13 @@
}
c: (string){ "dog" }
}
+-- out/compile --
+--- in.cue
+{
+ a: 〈import;strings〉.ContainsAny("ab")
+ a: "after"
+ b: 〈import;strings〉.ContainsAny("c")
+ b: "dog"
+ c: (〈import;strings〉.ContainsAny("d") & 〈import;strings〉.ContainsAny("g"))
+ c: "dog"
+}
diff --git a/cue/testdata/resolve/034_closing_structs.txtar b/cue/testdata/resolve/034_closing_structs.txtar
index 227f9a8..9329430 100644
--- a/cue/testdata/resolve/034_closing_structs.txtar
+++ b/cue/testdata/resolve/034_closing_structs.txtar
@@ -105,3 +105,34 @@
x: (int){ int }
}
}
+-- out/compile --
+--- in.cue
+{
+ op: {
+ x: int
+ }
+ ot: {
+ x: int
+ ...
+ }
+ cp: close({
+ x: int
+ })
+ ct: close({
+ x: int
+ ...
+ })
+ opot: (〈0;op〉 & 〈0;ot〉)
+ otop: (〈0;ot〉 & 〈0;op〉)
+ opcp: (〈0;op〉 & 〈0;cp〉)
+ cpop: (〈0;cp〉 & 〈0;op〉)
+ opct: (〈0;op〉 & 〈0;ct〉)
+ ctop: (〈0;ct〉 & 〈0;op〉)
+ otcp: (〈0;ot〉 & 〈0;cp〉)
+ cpot: (〈0;cp〉 & 〈0;ot〉)
+ otct: (〈0;ot〉 & 〈0;ct〉)
+ ctot: (〈0;ct〉 & 〈0;ot〉)
+ cpct: (〈0;cp〉 & 〈0;ct〉)
+ ctcp: (〈0;ct〉 & 〈0;cp〉)
+ ctct: (〈0;ct〉 & 〈0;ct〉)
+}
diff --git a/cue/testdata/resolve/048_builtins.txtar b/cue/testdata/resolve/048_builtins.txtar
index 12cf475..ac56168 100644
--- a/cue/testdata/resolve/048_builtins.txtar
+++ b/cue/testdata/resolve/048_builtins.txtar
@@ -214,3 +214,71 @@
}
}
}
+-- out/compile --
+--- in.cue
+{
+ a1: {
+ a: and([
+ 〈0;b〉,
+ 〈0;c〉,
+ ])
+ b: =~"oo"
+ c: =~"fo"
+ }
+ a2: (〈0;a1〉 & {
+ a: "foo"
+ })
+ a3: (〈0;a1〉 & {
+ a: "bar"
+ })
+ o1: {
+ a: or([
+ 〈0;b〉,
+ 〈0;c〉,
+ ])
+ b: string
+ c: "bar"
+ }
+ o2: (〈0;o1〉 & {
+ a: "foo"
+ })
+ o3: (〈0;o1〉 & {
+ a: "foo"
+ b: "baz"
+ })
+ stringListErrors: {
+ a: {
+ x: [
+ string,
+ ...string,
+ ]
+ result: 〈import;strings〉.Join(〈0;x〉, " ")
+ }
+ b: {
+ x: [
+ int,
+ ...string,
+ ]
+ result: 〈import;strings〉.Join(〈0;x〉, " ")
+ }
+ c: {
+ x: []
+ result: 〈import;strings〉.Join(〈0;x〉, int)
+ }
+ }
+ decimalListErrors: {
+ a: {
+ x: [
+ string,
+ ]
+ result: 〈import;list〉.Avg(〈0;x〉)
+ }
+ b: {
+ x: [
+ int,
+ ...string,
+ ]
+ result: 〈import;list〉.Avg(〈0;x〉)
+ }
+ }
+}
diff --git a/internal/core/compile/compile_test.go b/internal/core/compile/compile_test.go
index e4ea14d..1bea647 100644
--- a/internal/core/compile/compile_test.go
+++ b/internal/core/compile/compile_test.go
@@ -80,22 +80,7 @@
}
var needFix = map[string]string{
- "export/020": "builtin",
- "fulleval/027_len_of_incomplete_types": "builtin",
- "fulleval/032_or_builtin_should_not_fail_on_non-concrete_empty_list": "builtin",
- "fulleval/053_issue312": "builtin",
- "resolve/034_closing_structs": "builtin",
- "resolve/048_builtins": "builtin",
-
- "fulleval/026_dont_convert_incomplete_errors_to_non-incomplete": "import",
- "fulleval/044_Issue_#178": "import",
- "fulleval/048_dont_pass_incomplete_values_to_builtins": "import",
- "fulleval/049_alias_reuse_in_nested_scope": "import",
- "fulleval/050_json_Marshaling_detects_incomplete": "import",
- "fulleval/051_detectIncompleteYAML": "import",
- "fulleval/052_detectIncompleteJSON": "import",
- "fulleval/056_issue314": "import",
- "resolve/013_custom_validators": "import",
+ "DIR/NAME": "explanation",
}
// TestX is for debugging. Do not delete.