add to from string
This commit is contained in:
45
db_test.go
45
db_test.go
@@ -135,3 +135,48 @@ func TestImplementations(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestToFromString(t *testing.T) {
|
||||
cases := []struct {
|
||||
key string
|
||||
t Type
|
||||
}{
|
||||
{
|
||||
key: "map",
|
||||
t: MAP,
|
||||
},
|
||||
{
|
||||
key: "bolt",
|
||||
t: BOLT,
|
||||
},
|
||||
{
|
||||
key: "cache",
|
||||
t: CACHE,
|
||||
},
|
||||
{
|
||||
key: "leveldb",
|
||||
t: LEVELDB,
|
||||
},
|
||||
{
|
||||
key: "memcache",
|
||||
t: MEMCACHE,
|
||||
},
|
||||
{
|
||||
key: "memcachecluster",
|
||||
t: MEMCACHECLUSTER,
|
||||
},
|
||||
{
|
||||
key: "mongo",
|
||||
t: MONGO,
|
||||
},
|
||||
}
|
||||
|
||||
for _, c := range cases {
|
||||
if TypeFromString(c.key) != c.t {
|
||||
t.Errorf("wrong type for %v: got %v", c.key, TypeFromString(c.key))
|
||||
}
|
||||
if c.key != c.t.String() {
|
||||
t.Errorf("wrong string for %v (%v): got %v", int(c.t), c.key, c.t.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user