1
0
Fork 0
mirror of https://github.com/Luzifer/vault-openvpn.git synced 2024-11-12 18:12:44 +00:00
vault-openvpn/vendor/github.com/mitchellh/mapstructure/mapstructure_bugs_test.go
Knut Ahlers b4cc42902e
Switch to dep from Godeps
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2017-10-10 10:19:14 +02:00

47 lines
856 B
Go

package mapstructure
import "testing"
// GH-1
func TestDecode_NilValue(t *testing.T) {
input := map[string]interface{}{
"vfoo": nil,
"vother": nil,
}
var result Map
err := Decode(input, &result)
if err != nil {
t.Fatalf("should not error: %s", err)
}
if result.Vfoo != "" {
t.Fatalf("value should be default: %s", result.Vfoo)
}
if result.Vother != nil {
t.Fatalf("Vother should be nil: %s", result.Vother)
}
}
// GH-10
func TestDecode_mapInterfaceInterface(t *testing.T) {
input := map[interface{}]interface{}{
"vfoo": nil,
"vother": nil,
}
var result Map
err := Decode(input, &result)
if err != nil {
t.Fatalf("should not error: %s", err)
}
if result.Vfoo != "" {
t.Fatalf("value should be default: %s", result.Vfoo)
}
if result.Vother != nil {
t.Fatalf("Vother should be nil: %s", result.Vother)
}
}