cue/format: some tweaks
Always keep tabs used for indentation and explicitly
expand. This fixes some alignment issues.
This also prepares for having better eval output.
The default for single-element objects without
position information is now to not simplify.
Change-Id: I47546bce433cf99e2fc153540591cea51841b24c
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/2165
Reviewed-by: Marcel van Lohuizen <mpvl@google.com>
diff --git a/internal/third_party/yaml/decode_test.go b/internal/third_party/yaml/decode_test.go
index 71cbf3c..d33e56c 100644
--- a/internal/third_party/yaml/decode_test.go
+++ b/internal/third_party/yaml/decode_test.go
@@ -209,7 +209,9 @@
// Structs
{
"a: {b: c}",
- `a b: "c"`,
+ `a: {
+ b: "c"
+}`,
},
{
"hello: world",
@@ -231,7 +233,10 @@
"a: true",
}, {
"{ a: 1, b: {c: 1} }",
- "a: 1\nb c: 1",
+ `a: 1
+b: {
+ c: 1
+}`,
},
// Some cross type conversions
@@ -396,7 +401,12 @@
d: 2`,
}, {
"a: &a {c: 1}\nb: *a",
- "a c: 1\nb c: 1",
+ `a: {
+ c: 1
+}
+b: {
+ c: 1
+}`,
}, {
"a: &a [1, 2]\nb: *a",
"a: [1, 2]\nb: [1, 2]", // TODO: a: [1, 2], b: a
@@ -449,7 +459,9 @@
// issue #295 (allow scalars with colons in flow mappings and sequences)
{
"a: {b: https://github.com/go-yaml/yaml}",
- `a b: "https://github.com/go-yaml/yaml"`,
+ `a: {
+ b: "https://github.com/go-yaml/yaml"
+}`,
},
{
"a: [https://github.com/go-yaml/yaml]",
@@ -493,13 +505,19 @@
a: 1
d: 4
c: 3
-sub e: 5`,
+sub: {
+ e: 5
+}`,
},
// Issue #39.
{
"a:\n b:\n c: d\n",
- `a b c: "d"`,
+ `a: {
+ b: {
+ c: "d"
+ }
+}`,
},
// Timestamps