Merge pull request #10 from armon/master
Allow decoding from map[interface{}]interface{}
diff --git a/mapstructure_bugs_test.go b/mapstructure_bugs_test.go
index ddb3b8e..7054f1a 100644
--- a/mapstructure_bugs_test.go
+++ b/mapstructure_bugs_test.go
@@ -23,3 +23,25 @@
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)
+ }
+}