c156716d01
Apparently fmt.Sscanln doesn't parse bool's properly and this isn't likely to be fixed by the Go team who regard sscanf as a mistake. This only uses sscan for integers and uses the correct routine for everything else. This also implements parsing time.Duration See: https://github.com/golang/go/issues/43306
22 lines
374 B
Go
22 lines
374 B
Go
package configstruct
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCamelToSnake(t *testing.T) {
|
|
for _, test := range []struct {
|
|
in string
|
|
want string
|
|
}{
|
|
{"", ""},
|
|
{"Type", "type"},
|
|
{"AuthVersion", "auth_version"},
|
|
{"AccessKeyID", "access_key_id"},
|
|
} {
|
|
got := camelToSnake(test.in)
|
|
assert.Equal(t, test.want, got, test.in)
|
|
}
|
|
}
|