From aebf0fcdc54f2101d72d3704b9cea0423fe66450 Mon Sep 17 00:00:00 2001 From: Yauhen Lazurkin Date: Sat, 9 Jul 2016 16:04:14 +0300 Subject: [PATCH] Issue-105 Add time.Duration in TestUnmarshal --- viper_test.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/viper_test.go b/viper_test.go index 858caff..140857d 100644 --- a/viper_test.go +++ b/viper_test.go @@ -453,10 +453,12 @@ func TestRecursiveAliases(t *testing.T) { func TestUnmarshal(t *testing.T) { SetDefault("port", 1313) Set("name", "Steve") + Set("duration", "1s1ms") type config struct { - Port int - Name string + Port int + Name string + Duration time.Duration } var C config @@ -466,14 +468,14 @@ func TestUnmarshal(t *testing.T) { t.Fatalf("unable to decode into struct, %v", err) } - assert.Equal(t, &C, &config{Name: "Steve", Port: 1313}) + assert.Equal(t, &C, &config{Name: "Steve", Port: 1313, Duration: time.Second + time.Millisecond}) Set("port", 1234) err = Unmarshal(&C) if err != nil { t.Fatalf("unable to decode into struct, %v", err) } - assert.Equal(t, &C, &config{Name: "Steve", Port: 1234}) + assert.Equal(t, &C, &config{Name: "Steve", Port: 1234, Duration: time.Second + time.Millisecond}) } func TestBindPFlags(t *testing.T) {