github.com/avicd/go-utilx@v0.1.0/conv/string_test.go (about) 1 package conv 2 3 import ( 4 "github.com/stretchr/testify/assert" 5 "testing" 6 ) 7 8 func TestCamelCase(t *testing.T) { 9 var str string 10 str = CamelCase("camel_case") 11 assert.Equal(t, "camelCase", str) 12 str = CamelCase("camel-case") 13 assert.Equal(t, "camelCase", str) 14 str = CamelCase("camel:case") 15 assert.Equal(t, "camelCase", str) 16 str = BigCamelCase("camel__case") 17 assert.Equal(t, "CamelCase", str) 18 } 19 20 func TestUnderLineCase(t *testing.T) { 21 var str string 22 str = UnderLineCase("camelCase") 23 assert.Equal(t, "camel_case", str) 24 }