Commit 58cc0977 authored by Kamil Kisiel's avatar Kamil Kisiel

Merge pull request #6 from dgryski/improve-test-coverage

Improve test coverage
parents 28ab321f 744522d9
......@@ -145,24 +145,6 @@ func (e *Encoder) encodeInt(k reflect.Kind, i int64) {
}
}
func (e *Encoder) encodeScalar(rv reflect.Value) {
switch rv.Kind() {
case reflect.Array, reflect.Slice:
if rv.Type().Elem().Kind() == reflect.Uint8 {
e.encodeBytes(rv.Bytes())
} else {
e.encodeArray(rv)
}
case reflect.Map:
e.encodeMap(rv)
case reflect.Interface:
e.encodeScalar(rv.Elem())
default:
e.encode(rv)
}
}
func (e *Encoder) encodeMap(m reflect.Value) {
keys := m.MapKeys()
......
......@@ -16,6 +16,10 @@ func TestEncode(t *testing.T) {
"graphite message",
[]interface{}{map[interface{}]interface{}{"values": []interface{}{float64(473), float64(497), float64(540), float64(1497), float64(1808), float64(1890), float64(2013), float64(1821), float64(1847), float64(2176), float64(2156), float64(1250), float64(2055), float64(1570), None{}, None{}}, "start": int64(1383782400), "step": int64(86400), "end": int64(1385164800), "name": "ZZZZ.UUUUUUUU.CCCCCCCC.MMMMMMMM.XXXXXXXXX.TTT"}},
},
{
"small types",
[]interface{}{int64(0), int64(1), int64(258), int64(65537), false, true},
},
}
for _, tt := range tests {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment