Skip to content

Commit

Permalink
Trivail: add key to empty map
Browse files Browse the repository at this point in the history
  • Loading branch information
hysios committed Jun 14, 2020
1 parent ba9263b commit 2dea323
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions map_test.go
Expand Up @@ -289,3 +289,20 @@ func TestGet(t *testing.T) {
})
}
}

func Test_setIndexPathEmpty(t *testing.T) {
var m = map[string]interface{}{}
v := reflect.ValueOf(&m)

err := setIndexPath(v, "platePic.mediaType", reflect.ValueOf("image/jpeg"))
assert.NoError(t, err)
pp.Println(m)

err = setIndexPath(v, "platePic.size", reflect.ValueOf(123456))
assert.NoError(t, err)
pp.Println(m)

err = setIndexPath(v, "platePic.data", reflect.ValueOf("hello world"))
assert.NoError(t, err)
pp.Println(m)
}

0 comments on commit 2dea323

Please sign in to comment.