webhookd/pkg/strcase/test/snake_test.go
2020-02-04 21:27:51 +00:00

26 lines
516 B
Go

package test
import (
"testing"
"github.com/ncarlier/webhookd/pkg/assert"
"github.com/ncarlier/webhookd/pkg/strcase"
)
func TestToSnakeCase(t *testing.T) {
testCases := []struct {
value string
expected string
}{
{"hello-world", "hello_world"},
{"helloWorld", "hello_world"},
{"HelloWorld", "hello_world"},
{"Hello/_World", "hello__world"},
{"Hello/world", "hello_world"},
}
for _, tc := range testCases {
value := strcase.ToSnake(tc.value)
assert.Equal(t, tc.expected, value, "")
}
}