diff options
author | Péter Szilágyi <peterke@gmail.com> | 2015-06-22 17:00:55 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2015-06-24 23:34:04 +0800 |
commit | 7bd71fa80071f86ca86ed7ef64ab51c88cabe7d4 (patch) | |
tree | 9f770d2f59ca1a3053ebf7aa7921a122aa3bc388 /Godeps/_workspace/src/github.com/rcrowley/go-metrics/json_test.go | |
parent | 7f92e708c504e1c4a7382c68b5a4ed68db9c8deb (diff) | |
download | go-tangerine-7bd71fa80071f86ca86ed7ef64ab51c88cabe7d4.tar.gz go-tangerine-7bd71fa80071f86ca86ed7ef64ab51c88cabe7d4.tar.zst go-tangerine-7bd71fa80071f86ca86ed7ef64ab51c88cabe7d4.zip |
godeps: pull in go-metrics
Diffstat (limited to 'Godeps/_workspace/src/github.com/rcrowley/go-metrics/json_test.go')
-rw-r--r-- | Godeps/_workspace/src/github.com/rcrowley/go-metrics/json_test.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Godeps/_workspace/src/github.com/rcrowley/go-metrics/json_test.go b/Godeps/_workspace/src/github.com/rcrowley/go-metrics/json_test.go new file mode 100644 index 000000000..cf70051f7 --- /dev/null +++ b/Godeps/_workspace/src/github.com/rcrowley/go-metrics/json_test.go @@ -0,0 +1,28 @@ +package metrics + +import ( + "bytes" + "encoding/json" + "testing" +) + +func TestRegistryMarshallJSON(t *testing.T) { + b := &bytes.Buffer{} + enc := json.NewEncoder(b) + r := NewRegistry() + r.Register("counter", NewCounter()) + enc.Encode(r) + if s := b.String(); "{\"counter\":{\"count\":0}}\n" != s { + t.Fatalf(s) + } +} + +func TestRegistryWriteJSONOnce(t *testing.T) { + r := NewRegistry() + r.Register("counter", NewCounter()) + b := &bytes.Buffer{} + WriteJSONOnce(r, b) + if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" { + t.Fail() + } +} |