MCPcopy Create free account
hub / github.com/astercloud/aster / TestMarshalDeterministicIndent

Function TestMarshalDeterministicIndent

pkg/util/json_test.go:175–187  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

173}
174
175func TestMarshalDeterministicIndent(t *testing.T) {
176 m := map[string]int{"b": 2, "a": 1}
177
178 data, err := MarshalDeterministicIndent(m, "", " ")
179 if err != nil {
180 t.Fatalf("MarshalDeterministicIndent failed: %v", err)
181 }
182
183 expected := "{\n \"a\": 1,\n \"b\": 2\n}"
184 if string(data) != expected {
185 t.Errorf("Expected:\n%s\nGot:\n%s", expected, string(data))
186 }
187}
188
189func TestMarshalDeterministicToBuffer(t *testing.T) {
190 m := map[string]int{"b": 2, "a": 1}

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected