Commit 34834057 authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

common: add test for empty val

parent 675c51e4
......@@ -100,6 +100,7 @@ func TestDecodeConfig(t *testing.T) {
func TestDecodeConfig_stringToSlice(t *testing.T) {
type Local struct {
Val []string
EmptyVal []string
}
raw := map[string]interface{}{
......@@ -108,6 +109,7 @@ func TestDecodeConfig_stringToSlice(t *testing.T) {
},
"val": "foo,{{user `foo`}}",
"emptyval": "",
}
var result Local
......@@ -120,6 +122,9 @@ func TestDecodeConfig_stringToSlice(t *testing.T) {
if !reflect.DeepEqual(result.Val, expected) {
t.Fatalf("invalid: %#v", result.Val)
}
if len(result.EmptyVal) > 0 {
t.Fatalf("invalid: %#v", result.EmptyVal)
}
}
// This test tests the case that a user var is used for an integer
......
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