Assisted-by: DeepSeek V4.1 Flash
This commit is contained in:
+15
-15
@@ -289,7 +289,7 @@ func TestEncoderLiteralMultilineFallsBackWhenUnsafe(t *testing.T) {
|
||||
if !bytes.HasPrefix(out, []byte("s = \"")) {
|
||||
t.Errorf("%s: expected the basic quoted form, got:\n%s", c.name, out)
|
||||
}
|
||||
re, err := Parse(out)
|
||||
re, err := ParseMap(out)
|
||||
if err != nil {
|
||||
t.Errorf("%s: re-parse: %v\ndoc:\n%s", c.name, err, out)
|
||||
continue
|
||||
@@ -448,7 +448,7 @@ func TestMarshalDuplicateKeyResolvesToOneField(t *testing.T) {
|
||||
if want := "name = \"outer\"\n"; string(out) != want {
|
||||
t.Errorf("output mismatch:\ngot: %q\nwant: %q", out, want)
|
||||
}
|
||||
if _, err := Parse(out); err != nil {
|
||||
if _, err := ParseMap(out); err != nil {
|
||||
t.Errorf("re-parse: %v\ndoc:\n%s", err, out)
|
||||
}
|
||||
}
|
||||
@@ -610,7 +610,7 @@ func TestMarshalMixedArrayWithInlineTable(t *testing.T) {
|
||||
// Parse accepts a mixed array (TOML allows any value kinds in one array),
|
||||
// so Marshal of the parsed tree must re-emit it. The table element has no
|
||||
// header form inside a value array and renders inline.
|
||||
tree, err := Parse([]byte("arr = [1, {a = 2}, \"x\"]\n"))
|
||||
tree, err := ParseMap([]byte("arr = [1, {a = 2}, \"x\"]\n"))
|
||||
if err != nil {
|
||||
t.Fatalf("parse: %v", err)
|
||||
}
|
||||
@@ -622,7 +622,7 @@ func TestMarshalMixedArrayWithInlineTable(t *testing.T) {
|
||||
if string(out) != want {
|
||||
t.Fatalf("output mismatch:\ngot: %q\nwant: %q", out, want)
|
||||
}
|
||||
re, err := Parse(out)
|
||||
re, err := ParseMap(out)
|
||||
if err != nil {
|
||||
t.Fatalf("re-parse: %v", err)
|
||||
}
|
||||
@@ -640,7 +640,7 @@ func TestMarshalValueArrayOfTablesStaysInline(t *testing.T) {
|
||||
"a = [{x = 1}, {x = 2}]\n",
|
||||
"b = [{x = 1}, 2, \"three\"]\n",
|
||||
} {
|
||||
tree, err := Parse([]byte(doc))
|
||||
tree, err := ParseMap([]byte(doc))
|
||||
if err != nil {
|
||||
t.Fatalf("%s: parse: %v", doc, err)
|
||||
}
|
||||
@@ -651,7 +651,7 @@ func TestMarshalValueArrayOfTablesStaysInline(t *testing.T) {
|
||||
if bytes.HasPrefix(out, []byte("[[")) {
|
||||
t.Errorf("%s: emitted the [[header]] form for a value array:\n%s", doc, out)
|
||||
}
|
||||
re, err := Parse(out)
|
||||
re, err := ParseMap(out)
|
||||
if err != nil {
|
||||
t.Fatalf("%s: re-parse: %v\ndoc:\n%s", doc, err, out)
|
||||
}
|
||||
@@ -695,7 +695,7 @@ func TestMarshalInlineTableWithDatetime(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMarshalArrayOfTablesStaysHeaderForm(t *testing.T) {
|
||||
tree, err := Parse([]byte("[[items]]\nname = \"a\"\n\n[[items]]\nname = \"b\"\n"))
|
||||
tree, err := ParseMap([]byte("[[items]]\nname = \"a\"\n\n[[items]]\nname = \"b\"\n"))
|
||||
if err != nil {
|
||||
t.Fatalf("parse: %v", err)
|
||||
}
|
||||
@@ -722,7 +722,7 @@ func TestMarshalFloatExponentNoLeadingZero(t *testing.T) {
|
||||
}
|
||||
// Parse to check the output is valid TOML (for a strict parser that
|
||||
// rejects leading zeros in exponents).
|
||||
if _, err := Parse(out); err != nil {
|
||||
if _, err := ParseMap(out); err != nil {
|
||||
t.Fatalf("marshalled output is not valid TOML:\n%s\nerror: %v", out, err)
|
||||
}
|
||||
if string(out) != "large = 1e+6\nsmall = 1e-5\n" {
|
||||
@@ -1161,7 +1161,7 @@ func TestMarshalThenParseRoundTrip(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("marshal: %v", err)
|
||||
}
|
||||
tree1, err := Parse(out)
|
||||
tree1, err := ParseMap(out)
|
||||
if err != nil {
|
||||
t.Fatalf("parse of marshalled: %v\noutput:\n%s", err, out)
|
||||
}
|
||||
@@ -1199,7 +1199,7 @@ created = 2026-06-26T10:00:00Z
|
||||
|
||||
mixed = [1, {n = 1, name = "a value long enough to push this line well past the one hundred column limit"}]
|
||||
`)
|
||||
tree1, err := Parse(src)
|
||||
tree1, err := ParseMap(src)
|
||||
if err != nil {
|
||||
t.Fatalf("parse src: %v", err)
|
||||
}
|
||||
@@ -1207,7 +1207,7 @@ mixed = [1, {n = 1, name = "a value long enough to push this line well past the
|
||||
if err != nil {
|
||||
t.Fatalf("marshal: %v", err)
|
||||
}
|
||||
tree2, err := Parse(out)
|
||||
tree2, err := ParseMap(out)
|
||||
if err != nil {
|
||||
t.Fatalf("re-parse marshalled: %v\noutput:\n%s", err, out)
|
||||
}
|
||||
@@ -1649,7 +1649,7 @@ func TestMarshalInlineTableBreaksWhenLong(t *testing.T) {
|
||||
}
|
||||
|
||||
// The broken form parses back to the same tree.
|
||||
tree, err := Parse(out)
|
||||
tree, err := ParseMap(out)
|
||||
if err != nil {
|
||||
t.Fatalf("parse of the encoder output: %v", err)
|
||||
}
|
||||
@@ -1758,11 +1758,11 @@ func TestEncoderInlineTablesOrderAndRoundTrip(t *testing.T) {
|
||||
t.Errorf("output mismatch:\ngot: %q\nwant: %q", compact, want)
|
||||
}
|
||||
|
||||
got, err := Parse(compact)
|
||||
got, err := ParseMap(compact)
|
||||
if err != nil {
|
||||
t.Fatalf("parse of the compact output: %v", err)
|
||||
}
|
||||
ref, err := Parse(headerForm)
|
||||
ref, err := ParseMap(headerForm)
|
||||
if err != nil {
|
||||
t.Fatalf("parse of the header output: %v", err)
|
||||
}
|
||||
@@ -1793,7 +1793,7 @@ func TestEncoderInlineTablesKeepsArraysOfTables(t *testing.T) {
|
||||
if string(out) != want {
|
||||
t.Errorf("output mismatch:\ngot: %q\nwant: %q", out, want)
|
||||
}
|
||||
tree, err := Parse(out)
|
||||
tree, err := ParseMap(out)
|
||||
if err != nil {
|
||||
t.Fatalf("parse: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user