MCPcopy
hub / github.com/bnb-chain/bsc / TestRegistryMarshallJSON

Function TestRegistryMarshallJSON

metrics/json_test.go:9–18  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestRegistryMarshallJSON(t *testing.T) {
10 b := &bytes.Buffer{}
11 enc := json.NewEncoder(b)
12 r := NewRegistry()
13 r.Register("counter", NewCounter())
14 enc.Encode(r)
15 if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" {
16 t.Fatalf(s)
17 }
18}
19
20func TestRegistryWriteJSONOnce(t *testing.T) {
21 r := NewRegistry()

Callers

nothing calls this directly

Calls 6

RegisterMethod · 0.95
NewRegistryFunction · 0.85
NewCounterFunction · 0.85
EncodeMethod · 0.65
StringMethod · 0.65
FatalfMethod · 0.45

Tested by

no test coverage detected