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

Function TestRegistryWriteJSONOnce

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

Source from the content-addressed store, hash-verified

18}
19
20func TestRegistryWriteJSONOnce(t *testing.T) {
21 r := NewRegistry()
22 r.Register("counter", NewCounter())
23 b := &bytes.Buffer{}
24 WriteJSONOnce(r, b)
25 if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" {
26 t.Fail()
27 }
28}

Callers

nothing calls this directly

Calls 6

RegisterMethod · 0.95
NewRegistryFunction · 0.85
NewCounterFunction · 0.85
WriteJSONOnceFunction · 0.85
FailMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected