Files
kong/defaults_test.go
T
2019-06-06 15:22:25 +10:00

20 lines
366 B
Go

package kong
import (
"testing"
"time"
"github.com/stretchr/testify/require"
)
func TestApplyDefaults(t *testing.T) {
type CLI struct {
Str string `default:"str"`
Duration time.Duration `default:"30s"`
}
cli := &CLI{}
err := ApplyDefaults(cli)
require.NoError(t, err)
require.Equal(t, &CLI{Str: "str", Duration: time.Second * 30}, cli)
}