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

Function TestMarshalDeterministic_Pointer

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

Source from the content-addressed store, hash-verified

158}
159
160func TestMarshalDeterministic_Pointer(t *testing.T) {
161 m := map[string]int{"b": 2, "a": 1}
162 ptr := &m
163
164 data, err := MarshalDeterministic(ptr)
165 if err != nil {
166 t.Fatalf("MarshalDeterministic failed: %v", err)
167 }
168
169 expected := `{"a":1,"b":2}`
170 if string(data) != expected {
171 t.Errorf("Expected %s, got %s", expected, string(data))
172 }
173}
174
175func TestMarshalDeterministicIndent(t *testing.T) {
176 m := map[string]int{"b": 2, "a": 1}

Callers

nothing calls this directly

Calls 1

MarshalDeterministicFunction · 0.85

Tested by

no test coverage detected