pkg/internal/builtin: use normal formatting for builtin test results

Change-Id: I631bb9af3ce934b13d89a6d1b6a4a524412755a4
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7849
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/pkg/crypto/md5/testdata/gen.txtar b/pkg/crypto/md5/testdata/gen.txtar
index b3879f7..4ee4344 100644
--- a/pkg/crypto/md5/testdata/gen.txtar
+++ b/pkg/crypto/md5/testdata/gen.txtar
@@ -5,6 +5,5 @@
 
 t1: len(md5.Sum("hash me"))
 -- out/md5 --
-(struct){
-  t1: (int){ 16 }
-}
+t1: 16
+
diff --git a/pkg/crypto/sha1/testdata/gen.txtar b/pkg/crypto/sha1/testdata/gen.txtar
index 2eedefa..abc2714 100644
--- a/pkg/crypto/sha1/testdata/gen.txtar
+++ b/pkg/crypto/sha1/testdata/gen.txtar
@@ -5,6 +5,5 @@
 
 t1: len(sha1.Sum("hash me"))
 -- out/sha1 --
-(struct){
-  t1: (int){ 20 }
-}
+t1: 20
+
diff --git a/pkg/crypto/sha256/testdata/gen.txtar b/pkg/crypto/sha256/testdata/gen.txtar
index e615110..0dd59c1 100644
--- a/pkg/crypto/sha256/testdata/gen.txtar
+++ b/pkg/crypto/sha256/testdata/gen.txtar
@@ -7,8 +7,7 @@
 t2: len(sha256.Sum256("hash me"))
 t3: len(sha256.Sum224("hash me"))
 -- out/sha256 --
-(struct){
-  t1: (bytes){ '\xeb \x1a\xf5\xaa\xf0\xd6\x06)\xd3Ҧ\x1eFl\xfc\x0f\xed\xb5\x17\xad\xd81\xec\xacR5\xe1کc\xd6' }
-  t2: (int){ 32 }
-  t3: (int){ 28 }
-}
+t1: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)\xd3Ҧ\x1eFl\xfc\x0f\xed\xb5\x17\xad\xd81\xec\xacR5\xe1کc\xd6'
+t2: 32
+t3: 28
+
diff --git a/pkg/crypto/sha512/testdata/gen.txtar b/pkg/crypto/sha512/testdata/gen.txtar
index a97e3da..e0703a9 100644
--- a/pkg/crypto/sha512/testdata/gen.txtar
+++ b/pkg/crypto/sha512/testdata/gen.txtar
@@ -8,9 +8,8 @@
 t3: len(sha512.Sum512_224("hash me"))
 t4: len(sha512.Sum512_256("hash me"))
 -- out/sha512 --
-(struct){
-  t1: (int){ 64 }
-  t2: (int){ 48 }
-  t3: (int){ 28 }
-  t4: (int){ 32 }
-}
+t1: 64
+t2: 48
+t3: 28
+t4: 32
+
diff --git a/pkg/encoding/base64/testdata/gen.txtar b/pkg/encoding/base64/testdata/gen.txtar
index f3fca2e..5302a90 100644
--- a/pkg/encoding/base64/testdata/gen.txtar
+++ b/pkg/encoding/base64/testdata/gen.txtar
@@ -13,14 +13,8 @@
 error in call to encoding/base64.Decode: illegal base64 data at input byte 0
 
 Result:
-(_|_){
-  // [eval]
-  t1: (string){ "Zm9v" }
-  t2: (bytes){ 'foo' }
-  t3: (_|_){
-    // [eval] error in call to encoding/base64.Decode: illegal base64 data at input byte 0
-  }
-  t4: (_|_){
-    // [eval] error in call to encoding/base64.Decode: base64: unsupported encoding: cannot use value {} (type struct) as null
-  }
-}
+t1: "Zm9v"
+t2: 'foo'
+t3: _|_ // error in call to encoding/base64.Decode: illegal base64 data at input byte 0 (and 1 more errors)
+t4: _|_ // error in call to encoding/base64.Decode: base64: unsupported encoding: cannot use value {} (type struct) as null (and 1 more errors)
+
diff --git a/pkg/encoding/csv/testdata/gen.txtar b/pkg/encoding/csv/testdata/gen.txtar
index 99b1fee..3f13470 100644
--- a/pkg/encoding/csv/testdata/gen.txtar
+++ b/pkg/encoding/csv/testdata/gen.txtar
@@ -7,19 +7,16 @@
 t2: csv.Encode([[1,2,3],[4,5],[7,8,9]])
 t3: csv.Encode([["a", "b"], ["c"]])
 -- out/csv --
-(struct){
-  t1: (#list){
-    0: (#list){
-      0: (string){ "1" }
-      1: (string){ "2" }
-      2: (string){ "3" }
-    }
-    1: (#list){
-      0: (string){ "4" }
-      1: (string){ "5" }
-      2: (string){ "6" }
-    }
-  }
-  t2: (string){ "1,2,3\n4,5\n7,8,9\n" }
-  t3: (string){ "a,b\nc\n" }
-}
+t1: [["1", "2", "3"], ["4", "5", "6"]]
+t2: """
+	1,2,3
+	4,5
+	7,8,9
+
+	"""
+t3: """
+	a,b
+	c
+
+	"""
+
diff --git a/pkg/encoding/hex/testdata/gen.txtar b/pkg/encoding/hex/testdata/gen.txtar
index 9dfba7a..e25a0d5 100644
--- a/pkg/encoding/hex/testdata/gen.txtar
+++ b/pkg/encoding/hex/testdata/gen.txtar
@@ -12,12 +12,11 @@
 error in call to encoding/hex.Decode: encoding/hex: invalid byte: U+006F 'o'
 
 Result:
-(_|_){
-  // [eval]
-  t1: (string){ "666f6f" }
-  t2: (bytes){ 'foo' }
-  t3: (_|_){
-    // [eval] error in call to encoding/hex.Decode: encoding/hex: invalid byte: U+006F 'o'
-  }
-  t4: (string){ "00000000  66 6f 6f                                          |foo|\n" }
-}
+t1: "666f6f"
+t2: 'foo'
+t3: _|_ // error in call to encoding/hex.Decode: encoding/hex: invalid byte: U+006F 'o' (and 1 more errors)
+t4: """
+	00000000  66 6f 6f                                          |foo|
+
+	"""
+
diff --git a/pkg/encoding/json/testdata/gen.txtar b/pkg/encoding/json/testdata/gen.txtar
index 6b737f9..f59b379 100644
--- a/pkg/encoding/json/testdata/gen.txtar
+++ b/pkg/encoding/json/testdata/gen.txtar
@@ -20,22 +20,33 @@
 a: error in call to encoding/json.Validate: invalid value 10 (out of bound <3)
 
 Result:
-(_|_){
-  // [eval]
-  t1: (bool){ true }
-  t2: (_|_){
-    // [eval] a: error in call to encoding/json.Validate: invalid value 10 (out of bound <3)
-  }
-  t3: (bool){ true }
-  t4: (string){ "[1,2]" }
-  t5: (string){ "{\n  \"a\": 1,\n  \"b\": 2\n}" }
-  t6: (int){ 1 }
-  t7: (string){ "{\"a\":1}\n{\"b\":2}\n" }
-  t8: (struct){
-    x: (int){ int }
-    y: (_|_){
-      // [incomplete] cannot convert incomplete value "int" to JSON
-    }
-  }
-  t9: (string){ "{\"a\":1}\n{\"b\":2}\n" }
+import "encoding/json"
+
+t1: true
+t2: _|_ // error in call to encoding/json.Validate: a: invalid value 10 (out of bound <3) (and 1 more errors)
+t3: true
+t4: "[1,2]"
+t5: """
+	{
+	  "a": 1,
+	  "b": 2
+	}
+	"""
+t6: 1
+t7: """
+	{"a":1}
+	{"b":2}
+
+	"""
+t8: {
+	x: int
+	y: json.Marshal({
+		a: x
+	})
 }
+t9: """
+	{"a":1}
+	{"b":2}
+
+	"""
+
diff --git a/pkg/encoding/yaml/testdata/gen.txtar b/pkg/encoding/yaml/testdata/gen.txtar
index fe7e8d8..034ef27 100644
--- a/pkg/encoding/yaml/testdata/gen.txtar
+++ b/pkg/encoding/yaml/testdata/gen.txtar
@@ -19,21 +19,26 @@
 b: error in call to encoding/yaml.Validate: incomplete value int
 
 Result:
-(_|_){
-  // [eval]
-  t1: (_|_){
-    // [eval] a: error in call to encoding/yaml.Validate: invalid value 4 (out of bound <3)
-  }
-  t2: (bool){ true }
-  t3: (_|_){
-    // [eval] b: error in call to encoding/yaml.Validate: incomplete value int
-  }
-  t4: (_|_){
-    // [eval] a: error in call to encoding/yaml.ValidatePartial: invalid value 4 (out of bound <3)
-  }
-  t5: (bool){ true }
-  t6: (bool){ true }
-  t7: (string){ "a: 1\n---\nb: 2\n" }
-  t8: (string){ "b: 2\n" }
-  t9: (string){ "a: 1\n---\nb: 2\n" }
-}
+t1: _|_ // error in call to encoding/yaml.Validate: a: invalid value 4 (out of bound <3) (and 1 more errors)
+t2: true
+t3: _|_ // error in call to encoding/yaml.Validate: b: incomplete value int (and 1 more errors)
+t4: _|_ // error in call to encoding/yaml.ValidatePartial: a: invalid value 4 (out of bound <3) (and 1 more errors)
+t5: true
+t6: true
+t7: """
+	a: 1
+	---
+	b: 2
+
+	"""
+t8: """
+	b: 2
+
+	"""
+t9: """
+	a: 1
+	---
+	b: 2
+
+	"""
+
diff --git a/pkg/internal/builtintest/testing.go b/pkg/internal/builtintest/testing.go
index d61494e..0f65167 100644
--- a/pkg/internal/builtintest/testing.go
+++ b/pkg/internal/builtintest/testing.go
@@ -19,8 +19,9 @@
 	"testing"
 
 	"cuelang.org/go/cue"
-	"cuelang.org/go/internal/core/debug"
+	"cuelang.org/go/cue/format"
 	"cuelang.org/go/internal/core/eval"
+	"cuelang.org/go/internal/core/export"
 	"cuelang.org/go/internal/core/validate"
 	"cuelang.org/go/internal/cuetxtar"
 )
@@ -36,9 +37,9 @@
 	test.Run(t, func(t *cuetxtar.Test) {
 		a := t.ValidInstances()
 
-		v, err := r.Build(a[0])
-		if err != nil {
-			t.Fatal(err)
+		v, errs := r.Build(a[0])
+		if errs != nil {
+			t.Fatal(errs)
 		}
 
 		e := eval.New(r)
@@ -54,7 +55,19 @@
 			fmt.Fprintln(t, "Result:")
 		}
 
-		debug.WriteNode(t, r, v, &debug.Config{Cwd: t.Dir})
-		fmt.Fprintln(t)
+		p := export.All
+		p.ShowErrors = true
+
+		files, errs := p.Vertex(r, test.Name, v)
+		if errs != nil {
+			t.Fatal(errs)
+		}
+
+		b, err := format.Node(files)
+		if err != nil {
+			t.Fatal(err)
+		}
+
+		fmt.Fprintln(t, string(b))
 	})
 }
diff --git a/pkg/list/testdata/gen.txtar b/pkg/list/testdata/gen.txtar
index fc6635e..65bc8e3 100644
--- a/pkg/list/testdata/gen.txtar
+++ b/pkg/list/testdata/gen.txtar
@@ -96,225 +96,67 @@
     ./in.cue:51:15
 
 Result:
-(_|_){
-  // [eval]
-  t1: (float){ 2.5 }
-  t2: (_|_){
-    // [eval] error in call to list.Avg: empty list
-  }
-  t3: (_|_){
-    // [eval] t3: cannot use "foo" (type string) as list in argument 1 to list.Avg:
-    //     ./in.cue:5:14
-  }
-  t4: (#list){
-    0: (int){ 1 }
-    1: (int){ 2 }
-    2: (int){ 3 }
-    3: (int){ 4 }
-  }
-  t5: (#list){
-    0: (int){ 3 }
-    1: (int){ 4 }
-  }
-  t6: (#list){
-  }
-  t7: (_|_){
-    // [eval] error in call to list.Drop: negative index
-  }
-  t8: (#list){
-    0: (int){ 1 }
-    1: (int){ 2 }
-    2: (int){ 3 }
-    3: (int){ 4 }
-  }
-  t9: (#list){
-    0: (int){ 1 }
-    1: (#list){
-      0: (#list){
-        0: (int){ 2 }
-        1: (int){ 3 }
-      }
-      1: (#list){
-      }
-    }
-    2: (#list){
-      0: (int){ 4 }
-    }
-  }
-  t10: (#list){
-    0: (int){ 1 }
-    1: (#list){
-      0: (int){ 2 }
-      1: (int){ 3 }
-    }
-    2: (#list){
-    }
-    3: (int){ 4 }
-  }
-  t11: (#list){
-    0: (int){ 1 }
-    1: (int){ 2 }
-    2: (int){ 3 }
-    3: (int){ 4 }
-  }
-  t12: (#list){
-  }
-  t13: (_|_){
-    // [eval] error in call to list.FlattenN: cannot use value "foo" (type string) as list
-  }
-  t14: (_|_){
-    // [eval] t14: cannot use "foo" (type string) as int in argument 2 to list.FlattenN:
-    //     ./in.cue:16:24
-  }
-  t15: (float){ 4 }
-  t16: (_|_){
-    // [eval] error in call to list.Max: empty list
-  }
-  t17: (_|_){
-    // [eval] t17: cannot use "foo" (type string) as list in argument 1 to list.Max:
-    //     ./in.cue:19:15
-  }
-  t18: (float){ 1 }
-  t19: (_|_){
-    // [eval] error in call to list.Min: empty list
-  }
-  t20: (_|_){
-    // [eval] t20: cannot use "foo" (type string) as list in argument 1 to list.Min:
-    //     ./in.cue:22:15
-  }
-  t21: (float){ 24 }
-  t22: (float){ 1 }
-  t23: (_|_){
-    // [eval] t23: cannot use "foo" (type string) as list in argument 1 to list.Product:
-    //     ./in.cue:25:19
-  }
-  t24: (_|_){
-    // [eval] error in call to list.Range: step must be non zero
-  }
-  t25: (_|_){
-    // [eval] error in call to list.Range: end must be greater than start when step is positive
-  }
-  t26: (_|_){
-    // [eval] error in call to list.Range: end must be less than start when step is negative
-  }
-  t27: (#list){
-    0: (float){ 0 }
-    1: (float){ 1 }
-    2: (float){ 2 }
-    3: (float){ 3 }
-    4: (float){ 4 }
-  }
-  t28: (#list){
-    0: (float){ 0 }
-  }
-  t29: (#list){
-    0: (float){ 0 }
-    1: (float){ 2 }
-    2: (float){ 4 }
-  }
-  t30: (#list){
-    0: (float){ 5 }
-    1: (float){ 4 }
-    2: (float){ 3 }
-    3: (float){ 2 }
-    4: (float){ 1 }
-  }
-  t31: (#list){
-    0: (float){ 0 }
-    1: (float){ 0.5 }
-    2: (float){ 1.0 }
-    3: (float){ 1.5 }
-    4: (float){ 2.0 }
-    5: (float){ 2.5 }
-    6: (float){ 3.0 }
-    7: (float){ 3.5 }
-    8: (float){ 4.0 }
-    9: (float){ 4.5 }
-  }
-  t32: (#list){
-    0: (int){ 2 }
-    1: (int){ 3 }
-  }
-  t33: (_|_){
-    // [eval] error in call to list.Slice: negative index
-  }
-  t34: (_|_){
-    // [eval] error in call to list.Slice: invalid index: 3 > 1
-  }
-  t35: (_|_){
-    // [eval] error in call to list.Slice: slice bounds out of range
-  }
-  t36: (_|_){
-    // [eval] error in call to list.Slice: slice bounds out of range
-  }
-  t37: (#list){
-  }
-  t38: (#list){
-    0: (int){ 1 }
-    1: (int){ 2 }
-    2: (int){ 3 }
-    3: (int){ 4 }
-  }
-  t39: (#list){
-    0: (struct){
-      a: (int){ 1 }
-      v: (int){ 2 }
-    }
-    1: (struct){
-      a: (int){ 1 }
-      v: (int){ 3 }
-    }
-    2: (struct){
-      a: (int){ 2 }
-      v: (int){ 1 }
-    }
-  }
-  t40: (_|_){
-    // [eval] Ascending.x: error in call to list.Sort: conflicting values number and {b:2} (mismatched types number and struct)
-    // Ascending.x: error in call to list.Sort: conflicting values string and {b:2} (mismatched types string and struct)
-    // Ascending.x: error in call to list.Sort: empty disjunction: 2 related errors:
-    // Ascending.y: error in call to list.Sort: conflicting values number and {a:1} (mismatched types number and struct)
-    // Ascending.y: error in call to list.Sort: conflicting values string and {a:1} (mismatched types string and struct)
-    // Ascending.y: error in call to list.Sort: empty disjunction: 2 related errors:
-  }
-  t41: (#list){
-    0: (string){ "a" }
-    1: (string){ "b" }
-  }
-  t42: (_|_){
-    // [eval] 0: error in call to list.SortStrings: element 0 of list argument 0: cannot use value 1 (type int) as string
-  }
-  t43: (float){ 10 }
-  t44: (float){ 0 }
-  t45: (_|_){
-    // [eval] t45: cannot use "foo" (type string) as list in argument 1 to list.Sum:
-    //     ./in.cue:51:15
-  }
-  t46: (#list){
-  }
-  t47: (#list){
-    0: (int){ 1 }
-    1: (int){ 2 }
-  }
-  t48: (#list){
-    0: (int){ 1 }
-    1: (int){ 2 }
-    2: (int){ 3 }
-    3: (int){ 4 }
-  }
-  t49: (_|_){
-    // [eval] error in call to list.Take: negative index
-  }
-  t50: (bool){ true }
-  t51: (bool){ false }
-  t52: (bool){ true }
-  t53: (bool){ false }
-  t54: (_|_){
-    // [eval] Ascending.x: error in call to list.Sort: conflicting values number and {b:2} (mismatched types number and struct)
-    // Ascending.x: error in call to list.Sort: conflicting values string and {b:2} (mismatched types string and struct)
-    // Ascending.x: error in call to list.Sort: empty disjunction: 2 related errors:
-    // Ascending.y: error in call to list.Sort: conflicting values number and {a:1} (mismatched types number and struct)
-    // Ascending.y: error in call to list.Sort: conflicting values string and {a:1} (mismatched types string and struct)
-    // Ascending.y: error in call to list.Sort: empty disjunction: 2 related errors:
-  }
-}
+t1: 2.5
+t2: _|_ // error in call to list.Avg: empty list (and 1 more errors)
+t3: _|_ // t3: cannot use "foo" (type string) as list in argument 1 to list.Avg
+t4: [1, 2, 3, 4]
+t5: [3, 4]
+t6: []
+t7: _|_ // error in call to list.Drop: negative index (and 1 more errors)
+t8: [1, 2, 3, 4]
+t9: [1, [[2, 3], []], [4]]
+t10: [1, [2, 3], [], 4]
+t11: [1, 2, 3, 4]
+t12: []
+t13: _|_ // error in call to list.FlattenN: cannot use value "foo" (type string) as list (and 1 more errors)
+t14: _|_ // t14: cannot use "foo" (type string) as int in argument 2 to list.FlattenN
+t15: 4
+t16: _|_ // error in call to list.Max: empty list (and 1 more errors)
+t17: _|_ // t17: cannot use "foo" (type string) as list in argument 1 to list.Max
+t18: 1
+t19: _|_ // error in call to list.Min: empty list (and 1 more errors)
+t20: _|_ // t20: cannot use "foo" (type string) as list in argument 1 to list.Min
+t21: 24
+t22: 1
+t23: _|_ // t23: cannot use "foo" (type string) as list in argument 1 to list.Product
+t24: _|_ // error in call to list.Range: step must be non zero (and 1 more errors)
+t25: _|_ // error in call to list.Range: end must be greater than start when step is positive (and 1 more errors)
+t26: _|_ // error in call to list.Range: end must be less than start when step is negative (and 1 more errors)
+t27: [0, 1, 2, 3, 4]
+t28: [0]
+t29: [0, 2, 4]
+t30: [5, 4, 3, 2, 1]
+t31: [0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5]
+t32: [2, 3]
+t33: _|_ // error in call to list.Slice: negative index (and 1 more errors)
+t34: _|_ // error in call to list.Slice: invalid index: 3 > 1 (and 1 more errors)
+t35: _|_ // error in call to list.Slice: slice bounds out of range (and 1 more errors)
+t36: _|_ // error in call to list.Slice: slice bounds out of range (and 1 more errors)
+t37: []
+t38: [1, 2, 3, 4]
+t39: [{
+	a: 1
+	v: 2
+}, {
+	a: 1
+	v: 3
+}, {
+	a: 2
+	v: 1
+}]
+t40: _|_ // error in call to list.Sort: Ascending.x: empty disjunction: 2 related errors: (and 11 more errors)
+t41: ["a", "b"]
+t42: _|_ // error in call to list.SortStrings: element 0 of list argument 0: 0: cannot use value 1 (type int) as string (and 1 more errors)
+t43: 10
+t44: 0
+t45: _|_ // t45: cannot use "foo" (type string) as list in argument 1 to list.Sum
+t46: []
+t47: [1, 2]
+t48: [1, 2, 3, 4]
+t49: _|_ // error in call to list.Take: negative index (and 1 more errors)
+t50: true
+t51: false
+t52: true
+t53: false
+t54: _|_ // error in call to list.Sort: Ascending.x: empty disjunction: 2 related errors: (and 11 more errors)
+
diff --git a/pkg/list/testdata/issues.txtar b/pkg/list/testdata/issues.txtar
index 5108373..df81d84 100644
--- a/pkg/list/testdata/issues.txtar
+++ b/pkg/list/testdata/issues.txtar
@@ -27,76 +27,22 @@
     output: [...#MyDef] & list.FlattenN(_all, 1)
 }
 -- out/list --
-(struct){
-  issue563: (struct){
-    #MyDef: (#struct){
-      name: (string){ string }
-    }
-    _all: (#list){
-      0: (#list){
-        0: (#struct){
-          name: (string){ "a" }
-        }
-        1: (#struct){
-          name: (string){ "b" }
-        }
-        2: (#struct){
-          name: (string){ "c" }
-        }
-      }
-      1: (#list){
-        0: (#struct){
-          name: (string){ "1" }
-        }
-        1: (#struct){
-          name: (string){ "2" }
-        }
-        2: (#struct){
-          name: (string){ "3" }
-        }
-      }
-    }
-    _a: (#list){
-      0: (#struct){
-        name: (string){ "a" }
-      }
-      1: (#struct){
-        name: (string){ "b" }
-      }
-      2: (#struct){
-        name: (string){ "c" }
-      }
-    }
-    _b: (#list){
-      0: (#struct){
-        name: (string){ "1" }
-      }
-      1: (#struct){
-        name: (string){ "2" }
-      }
-      2: (#struct){
-        name: (string){ "3" }
-      }
-    }
-    output: (#list){
-      0: (#struct){
-        name: (string){ "a" }
-      }
-      1: (#struct){
-        name: (string){ "b" }
-      }
-      2: (#struct){
-        name: (string){ "c" }
-      }
-      3: (#struct){
-        name: (string){ "1" }
-      }
-      4: (#struct){
-        name: (string){ "2" }
-      }
-      5: (#struct){
-        name: (string){ "3" }
-      }
-    }
-  }
+issue563: {
+	#MyDef: {
+		name: string
+	}
+	output: [{
+		name: "a"
+	}, {
+		name: "b"
+	}, {
+		name: "c"
+	}, {
+		name: "1"
+	}, {
+		name: "2"
+	}, {
+		name: "3"
+	}]
 }
+
diff --git a/pkg/math/bits/testdata/gen.txtar b/pkg/math/bits/testdata/gen.txtar
index af483ac..0106e93 100644
--- a/pkg/math/bits/testdata/gen.txtar
+++ b/pkg/math/bits/testdata/gen.txtar
@@ -17,18 +17,17 @@
 t12: bits.Clear(0xF, 0x100000000000008)
 t13: bits.Clear(0x1000000000000000008, 0xF)
 -- out/bits --
-(struct){
-  t1: (int){ 9 }
-  t2: (int){ 128 }
-  t3: (int){ 16 }
-  t4: (int){ 1 }
-  t5: (int){ 0 }
-  t6: (int){ 384 }
-  t7: (int){ 0 }
-  t8: (int){ 6 }
-  t9: (int){ 18446744073709551871 }
-  t10: (int){ 18446744073709551871 }
-  t11: (int){ 18446744073709551871 }
-  t12: (int){ 7 }
-  t13: (int){ 4722366482869645213696 }
-}
+t1:  9
+t2:  128
+t3:  16
+t4:  1
+t5:  0
+t6:  384
+t7:  0
+t8:  6
+t9:  18446744073709551871
+t10: 18446744073709551871
+t11: 18446744073709551871
+t12: 7
+t13: 4722366482869645213696
+
diff --git a/pkg/math/testdata/gen.txtar b/pkg/math/testdata/gen.txtar
index 6f449bf..1c51600 100644
--- a/pkg/math/testdata/gen.txtar
+++ b/pkg/math/testdata/gen.txtar
@@ -32,34 +32,24 @@
     ./in.cue:8:5
 
 Result:
-(_|_){
-  // [eval]
-  t1: (float){ 3.14159265358979323846264338327950288419716939937510582097494459 }
-  t2: (int){ 3 }
-  t3: (_|_){
-    // [eval] t3: cannot call non-function math.Pi (type float):
-    //     ./in.cue:5:5
-  }
-  t6: (_|_){
-    // [eval] error in call to math.Jacobi: big: invalid 2nd argument to Int.Jacobi: need odd integer but got 2000
-  }
-  t7: (int){ 1 }
-  t8: (_|_){
-    // [eval] cannot use 2.0E+400 (type float) as float64 in argument 0 to math.Asin: value was rounded up:
-    //     ./in.cue:8:5
-  }
-  t16: (float){ 4096 }
-  t17: (float){ 1E+4 }
-  t18: (bool){ true }
-  t23: (float){ 2.5 }
-  t24: (float){ 2.2 }
-  t25: (float){ 1.25992104989487316476721 }
-  t26: (float){ -5 }
-  t27: (float){ 20.0855369231876677409285 }
-  t28: (float){ 11.3137084989847603904135 }
-  t29: (float){ 1.38629436111989061883446 }
-  t30: (float){ 0.602059991327962390427478 }
-  t31: (float){ 2.32192809488736234787032 }
-  t32: (float){ 0.5 }
-  t33: (float){ 0 }
-}
+t1:  3.14159265358979323846264338327950288419716939937510582097494459
+t2:  3
+t3:  _|_ // t3: cannot call non-function math.Pi (type float)
+t6:  _|_ // error in call to math.Jacobi: big: invalid 2nd argument to Int.Jacobi: need odd integer but got 2000 (and 1 more errors)
+t7:  1
+t8:  _|_ // cannot use 2.0E+400 (type float) as float64 in argument 0 to math.Asin: value was rounded up (and 1 more errors)
+t16: 4096
+t17: 1e+4
+t18: true
+t23: 2.5
+t24: 2.2
+t25: 1.25992104989487316476721
+t26: -5
+t27: 20.0855369231876677409285
+t28: 11.3137084989847603904135
+t29: 1.38629436111989061883446
+t30: 0.602059991327962390427478
+t31: 2.32192809488736234787032
+t32: 0.5
+t33: 0
+
diff --git a/pkg/math/testdata/issue418.txtar b/pkg/math/testdata/issue418.txtar
index 547f2e9..d6d547c 100644
--- a/pkg/math/testdata/issue418.txtar
+++ b/pkg/math/testdata/issue418.txtar
@@ -19,19 +19,12 @@
     ./in.cue:12:8
 
 Result:
-(_|_){
-  // [eval]
-  a: (struct){
-    x: (float){ 32.45 }
-    y: (int){ 32 }
-  }
-  b: (_|_){
-    // [eval]
-    x: (float){ 32.45 }
-    y: (_|_){
-      // [eval] b.y: conflicting values int and 3.47970044315009900124277 (mismatched types int and float):
-      //     ./in.cue:11:8
-      //     ./in.cue:12:8
-    }
-  }
+a: {
+	x: 32.45
+	y: 32
 }
+b: {
+	x: 32.45
+	y: _|_ // b.y: conflicting values int and 3.47970044315009900124277 (mismatched types int and float)
+}
+
diff --git a/pkg/math/testdata/round.txtar b/pkg/math/testdata/round.txtar
index b1eda54..fa3b04e 100644
--- a/pkg/math/testdata/round.txtar
+++ b/pkg/math/testdata/round.txtar
@@ -41,36 +41,27 @@
     ./in.cue:18:21
 
 Result:
-(_|_){
-  // [eval]
-  mul0: (bool){ true }
-  mul1: (bool){ false }
-  mul2: (_|_){
-    // [eval] error in call to math.MultipleOf: division by zero
-  }
-  mul3: (bool){ false }
-  mul4: (bool){ true }
-  mul5: (bool){ true }
-  mul6: (bool){ true }
-  r0: (int){ 3 }
-  r1: (int){ -3 }
-  r2: (int){ 2 }
-  r3: (int){ -2 }
-  floorE1: (_|_){
-    // [eval] floorE1: too many arguments in call to math.Floor (have 2, want 1):
-    //     ./in.cue:17:25
-  }
-  floorE2: (_|_){
-    // [eval] floorE2: cannot use "foo" (type string) as number in argument 1 to math.Floor:
-    //     ./in.cue:18:21
-  }
-  floor0: (int){ 3 }
-  floor1: (int){ 2 }
-  floor2: (int){ -3 }
-  floor3: (int){ 2900 }
-  floor4: (int){ 2900 }
-  ceil0: (int){ 3 }
-  ceil1: (int){ -2 }
-  trunc0: (int){ 2 }
-  trunc1: (int){ -2 }
-}
+mul0: true
+mul1: false
+// TODO(errors): ensure path is included for the following error.
+mul2:    _|_ // error in call to math.MultipleOf: division by zero (and 1 more errors)
+mul3:    false
+mul4:    true
+mul5:    true
+mul6:    true
+r0:      3
+r1:      -3
+r2:      2
+r3:      -2
+floorE1: _|_ // floorE1: too many arguments in call to math.Floor (have 2, want 1)
+floorE2: _|_ // floorE2: cannot use "foo" (type string) as number in argument 1 to math.Floor
+floor0:  3
+floor1:  2
+floor2:  -3
+floor3:  2900
+floor4:  2900
+ceil0:   3
+ceil1:   -2
+trunc0:  2
+trunc1:  -2
+
diff --git a/pkg/net/testdata/gen.txtar b/pkg/net/testdata/gen.txtar
index 7d76d17..1f124a3 100644
--- a/pkg/net/testdata/gen.txtar
+++ b/pkg/net/testdata/gen.txtar
@@ -28,55 +28,21 @@
     ./in.cue:15:6
 
 Result:
-(_|_){
-  // [eval]
-  t1: (string){ "foo.bar." }
-  t2: (bool){ false }
-  t3: (#list){
-    0: (string){ "::%lo0" }
-    1: (string){ "80" }
-  }
-  t4: (string){ "example.com:80" }
-  t5: (string){ "[2001:db8::1]:80" }
-  t6: (string){ "192.30.4.2:80" }
-  t7: (_|_){
-    // [eval] error in call to net.JoinHostPort: invalid host [192, 30, 4]
-  }
-  t8: (bool){ true }
-  t9: (_|_){
-    // [eval] t9: invalid value "23.23.23.2333" (does not satisfy net.IPv4)
-  }
-  t10: (bool){ true }
-  t11: (bool){ true }
-  t12: (bool){ false }
-  t13: (_|_){
-    // [eval] t13: invalid value "ff02::1:3" (does not satisfy net.IPv4):
-    //     ./in.cue:15:6
-  }
-  t14: (bool){ true }
-  t15: (bool){ true }
-  t16: (#list){
-    0: (int){ 127 }
-    1: (int){ 0 }
-    2: (int){ 0 }
-    3: (int){ 1 }
-  }
-  t17: (#list){
-    0: (int){ 0 }
-    1: (int){ 0 }
-    2: (int){ 0 }
-    3: (int){ 0 }
-    4: (int){ 0 }
-    5: (int){ 0 }
-    6: (int){ 0 }
-    7: (int){ 0 }
-    8: (int){ 0 }
-    9: (int){ 0 }
-    10: (int){ 255 }
-    11: (int){ 255 }
-    12: (int){ 127 }
-    13: (int){ 0 }
-    14: (int){ 0 }
-    15: (int){ 1 }
-  }
-}
+t1: "foo.bar."
+t2: false
+t3: ["::%lo0", "80"]
+t4:  "example.com:80"
+t5:  "[2001:db8::1]:80"
+t6:  "192.30.4.2:80"
+t7:  _|_ // error in call to net.JoinHostPort: invalid host [192, 30, 4] (and 1 more errors)
+t8:  true
+t9:  _|_ // t9: invalid value "23.23.23.2333" (does not satisfy net.IPv4)
+t10: true
+t11: true
+t12: false
+t13: _|_ // t13: invalid value "ff02::1:3" (does not satisfy net.IPv4)
+t14: true
+t15: true
+t16: [127, 0, 0, 1]
+t17: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 127, 0, 0, 1]
+
diff --git a/pkg/regexp/testdata/gen.txtar b/pkg/regexp/testdata/gen.txtar
index 5400e86..8560e28 100644
--- a/pkg/regexp/testdata/gen.txtar
+++ b/pkg/regexp/testdata/gen.txtar
@@ -26,76 +26,32 @@
 error in call to regexp.Valid: error parsing regexp: unexpected ): `invalid)`
 
 Result:
-(_|_){
-  // [eval]
-  t1: (string){ "foo" }
-  t2: (_|_){
-    // [eval] error in call to regexp.Find: no match
-  }
-  t3: (#list){
-    0: (string){ "foo" }
-    1: (string){ "flo" }
-  }
-  t4: (#list){
-    0: (string){ "foo" }
-    1: (string){ "flo" }
-  }
-  t5: (_|_){
-    // [eval] error in call to regexp.FindAll: no match
-  }
-  t6: (#list){
-    0: (string){ "flo" }
-    1: (string){ "l" }
-    2: (string){ "o" }
-  }
-  t7: (#list){
-    0: (#list){
-      0: (string){ "flo" }
-      1: (string){ "l" }
-      2: (string){ "o" }
-    }
-    1: (#list){
-      0: (string){ "foo" }
-      1: (string){ "o" }
-      2: (string){ "o" }
-    }
-    2: (#list){
-      0: (string){ "fro" }
-      1: (string){ "r" }
-      2: (string){ "o" }
-    }
-  }
-  t8: (_|_){
-    // [eval] error in call to regexp.FindAllSubmatch: no match
-  }
-  t9: (struct){
-    A: (string){ "l" }
-    B: (string){ "o" }
-  }
-  t10: (#list){
-    0: (struct){
-      A: (string){ "l" }
-      B: (string){ "o" }
-    }
-    1: (struct){
-      A: (string){ "o" }
-      B: (string){ "o" }
-    }
-    2: (struct){
-      A: (string){ "r" }
-      B: (string){ "o" }
-    }
-  }
-  t11: (#list){
-    0: (struct){
-      A: (string){ "" }
-    }
-  }
-  t12: (_|_){
-    // [eval] error in call to regexp.FindAllNamedSubmatch: no match
-  }
-  t13: (string){ "valid" }
-  t14: (_|_){
-    // [eval] error in call to regexp.Valid: error parsing regexp: unexpected ): `invalid)`
-  }
+t1: "foo"
+t2: _|_ // error in call to regexp.Find: no match (and 1 more errors)
+t3: ["foo", "flo"]
+t4: ["foo", "flo"]
+t5: _|_ // error in call to regexp.FindAll: no match (and 1 more errors)
+t6: ["flo", "l", "o"]
+t7: [["flo", "l", "o"], ["foo", "o", "o"], ["fro", "r", "o"]]
+t8: _|_ // error in call to regexp.FindAllSubmatch: no match (and 1 more errors)
+t9: {
+	A: "l"
+	B: "o"
 }
+t10: [{
+	A: "l"
+	B: "o"
+}, {
+	A: "o"
+	B: "o"
+}, {
+	A: "r"
+	B: "o"
+}]
+t11: [{
+	A: ""
+}]
+t12: _|_ // error in call to regexp.FindAllNamedSubmatch: no match (and 1 more errors)
+t13: "valid"
+t14: _|_ // error in call to regexp.Valid: error parsing regexp: unexpected ): `invalid)`
+
diff --git a/pkg/strconv/testdata/gen.txtar b/pkg/strconv/testdata/gen.txtar
index 479d204..c18d09a 100644
--- a/pkg/strconv/testdata/gen.txtar
+++ b/pkg/strconv/testdata/gen.txtar
@@ -18,20 +18,9 @@
     ./in.cue:6:31
 
 Result:
-(_|_){
-  // [eval]
-  t1: (string){ "40" }
-  t2: (_|_){
-    // [eval] int 300 overflows byte in argument 1 in call to strconv.FormatFloat:
-    //     ./in.cue:4:5
-  }
-  t3: (_|_){
-    // [eval] cannot use -1 (type int) as byte in argument 1 to strconv.FormatFloat:
-    //     ./in.cue:5:5
-  }
-  t4: (_|_){
-    // [eval] t4: cannot use 1.0 (type float) as int in argument 2 to strconv.FormatFloat:
-    //     ./in.cue:6:31
-  }
-  t5: (string){ "true" }
-}
+t1: "40"
+t2: _|_ // int 300 overflows byte in argument 1 in call to strconv.FormatFloat (and 1 more errors)
+t3: _|_ // cannot use -1 (type int) as byte in argument 1 to strconv.FormatFloat (and 1 more errors)
+t4: _|_ // t4: cannot use 1.0 (type float) as int in argument 2 to strconv.FormatFloat
+t5: "true"
+
diff --git a/pkg/strings/testdata/gen.txtar b/pkg/strings/testdata/gen.txtar
index c06cf77..837820b 100644
--- a/pkg/strings/testdata/gen.txtar
+++ b/pkg/strings/testdata/gen.txtar
@@ -33,42 +33,21 @@
     ./in.cue:19:6
 
 Result:
-(_|_){
-  // [eval]
-  t1: (string){ "Hello World!" }
-  t2: (_|_){
-    // [eval] 0: error in call to strings.Join: element 0 of list argument 0: cannot use value 1 (type int) as string
-  }
-  t3: (int){ 97 }
-  t4: (bytes){ 'llo' }
-  t5: (string){ "✓ H" }
-  t6: (#list){
-    0: (int){ 67 }
-    1: (int){ 97 }
-    2: (int){ 102 }
-    3: (int){ 233 }
-  }
-  t7: (string){ "alphaBeta" }
-  t8: (string){ "Alpha" }
-  t9: (string){ "foo" }
-  t10: (_|_){
-    // [eval] t10: invalid value "quux" (does not satisfy strings.MaxRunes(3)):
-    //     ./in.cue:12:6
-  }
-  t11: (string){ "e" }
-  t12: (_|_){
-    // [eval] t12: invalid value "e" (does not satisfy strings.MaxRunes(0)):
-    //     ./in.cue:14:6
-  }
-  t13: (string){ "" }
-  t14: (string){ "hello" }
-  t15: (string){ "hello" }
-  t16: (_|_){
-    // [eval] t16: invalid value "hello" (does not satisfy strings.MaxRunes(3)):
-    //     ./in.cue:18:6
-  }
-  t17: (_|_){
-    // [eval] t17: invalid value "hello" (does not satisfy strings.MinRunes(10)):
-    //     ./in.cue:19:6
-  }
-}
+t1: "Hello World!"
+t2: _|_ // error in call to strings.Join: element 0 of list argument 0: 0: cannot use value 1 (type int) as string (and 1 more errors)
+t3: 97
+t4: 'llo'
+t5: "✓ H"
+t6: [67, 97, 102, 233]
+t7:  "alphaBeta"
+t8:  "Alpha"
+t9:  "foo"
+t10: _|_ // t10: invalid value "quux" (does not satisfy strings.MaxRunes(3))
+t11: "e"
+t12: _|_ // t12: invalid value "e" (does not satisfy strings.MaxRunes(0))
+t13: ""
+t14: "hello"
+t15: "hello"
+t16: _|_ // t16: invalid value "hello" (does not satisfy strings.MaxRunes(3))
+t17: _|_ // t17: invalid value "hello" (does not satisfy strings.MinRunes(10))
+
diff --git a/pkg/struct/testdata/gen.txtar b/pkg/struct/testdata/gen.txtar
index 4d46fa3..83c1382 100644
--- a/pkg/struct/testdata/gen.txtar
+++ b/pkg/struct/testdata/gen.txtar
@@ -19,27 +19,13 @@
     ./in.cue:6:5
 
 Result:
-(_|_){
-  // [eval]
-  t1: (_|_){
-    // [eval] t1: conflicting values struct.MinFields(0) and "" (mismatched types struct and string):
-    //     ./in.cue:3:5
-    //     ./in.cue:3:27
-  }
-  t2: (struct){
-    a: (int){ 1 }
-  }
-  t3: (_|_){
-    // [eval] t3: invalid value {a:1} (does not satisfy struct.MinFields(2)):
-    //     ./in.cue:5:5
-    a: (int){ 1 }
-  }
-  t4: (_|_){
-    // [eval] t4: invalid value {a:1} (does not satisfy struct.MaxFields(0)):
-    //     ./in.cue:6:5
-    a: (int){ 1 }
-  }
-  t5: (struct){
-    a: (int){ 1 }
-  }
+t1: _|_ // t1: conflicting values struct.MinFields(0) and "" (mismatched types struct and string)
+t2: {
+	a: 1
 }
+t3: _|_ // t3: invalid value {a:1} (does not satisfy struct.MinFields(2))
+t4: _|_ // t4: invalid value {a:1} (does not satisfy struct.MaxFields(0))
+t5: {
+	a: 1
+}
+
diff --git a/pkg/text/tabwriter/testdata/gen.txtar b/pkg/text/tabwriter/testdata/gen.txtar
index 41c88eb..1b4709b 100644
--- a/pkg/text/tabwriter/testdata/gen.txtar
+++ b/pkg/text/tabwriter/testdata/gen.txtar
@@ -11,7 +11,13 @@
 				"a\tb\tc",
 				"aaa\tbb\tvv"])
 -- out/tabwriter --
-(struct){
-  t1: (string){ "a   b  c\naaa bb vv" }
-  t2: (string){ "a   b  c\naaa bb vv\n" }
-}
+t1: """
+	a   b  c
+	aaa bb vv
+	"""
+t2: """
+	a   b  c
+	aaa bb vv
+
+	"""
+
diff --git a/pkg/text/template/testdata/gen.txtar b/pkg/text/template/testdata/gen.txtar
index faebc85..7389356 100644
--- a/pkg/text/template/testdata/gen.txtar
+++ b/pkg/text/template/testdata/gen.txtar
@@ -5,6 +5,5 @@
 
 t1: template.Execute("{{.}}-{{.}}", "foo")
 -- out/template --
-(struct){
-  t1: (string){ "foo-foo" }
-}
+t1: "foo-foo"
+
diff --git a/pkg/time/testdata/gen.txtar b/pkg/time/testdata/gen.txtar
index 9ed2159..6c02b50 100644
--- a/pkg/time/testdata/gen.txtar
+++ b/pkg/time/testdata/gen.txtar
@@ -11,11 +11,7 @@
 error in call to time.Time: invalid time "no time"
 
 Result:
-(_|_){
-  // [eval]
-  t1: (string){ "1937-01-01T12:00:27.87+00:20" }
-  t2: (_|_){
-    // [eval] error in call to time.Time: invalid time "no time"
-  }
-  t3: (string){ "2017-07-14T02:40:00.000123456Z" }
-}
+t1: "1937-01-01T12:00:27.87+00:20"
+t2: _|_ // error in call to time.Time: invalid time "no time"
+t3: "2017-07-14T02:40:00.000123456Z"
+