test: add FuzzMarshal, golden messages, synctest cancellation and cross smoke
Test / test (push) Successful in 1m31s
Test / test (push) Successful in 1m31s
Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -796,3 +796,28 @@ func TestParseAsAndNewSchema(t *testing.T) {
|
||||
}
|
||||
NewSchema[map[string]any]() // must not panic
|
||||
}
|
||||
|
||||
func TestZeroOffsetRoundTrip(t *testing.T) {
|
||||
// A document may write a zero offset as +00:00; the tree must hold the
|
||||
// same value after a round trip, because the written form is "Z" either
|
||||
// way.
|
||||
src := []byte("a = 1979-05-27T07:32:00+00:00\n")
|
||||
tree, err := ParseMap(src)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
out, err := Marshal(tree)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
re, err := ParseMap(out)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !reflect.DeepEqual(tree, re) {
|
||||
t.Errorf("round trip changed the tree: %#v vs %#v", tree, re)
|
||||
}
|
||||
if got := tree["a"].(OffsetDateTime).String(); got != "1979-05-27T07:32Z" {
|
||||
t.Errorf("a = %q, want 1979-05-27T07:32Z", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user