#1193 Expose constructor of MapInputSource type

main
Igor Artasevych 4 years ago
parent cd82784a53
commit 27a8625ccd

@ -16,6 +16,11 @@ type MapInputSource struct {
valueMap map[interface{}]interface{}
}
//NewMapInputSource create a new MapInputSource type
func NewMapInputSource(file string, valueMap map[interface{}]interface{}) *MapInputSource {
return &MapInputSource{file: file, valueMap: valueMap}
}
// nestedVal checks if the name has '.' delimiters.
// If so, it tries to traverse the tree by the '.' delimited sections to find
// a nested value for the key.

@ -6,14 +6,13 @@ import (
)
func TestMapDuration(t *testing.T) {
inputSource := &MapInputSource{
file: "test",
valueMap: map[interface{}]interface{}{
inputSource := NewMapInputSource(
"test",
map[interface{}]interface{}{
"duration_of_duration_type": time.Minute,
"duration_of_string_type": "1m",
"duration_of_int_type": 1000,
},
}
})
d, err := inputSource.Duration("duration_of_duration_type")
expect(t, time.Minute, d)
expect(t, nil, err)

Loading…
Cancel
Save