cosmossdk.io/client/v2@v2.0.0-beta.1/internal/strcase/kebab_test.go (about) 1 package strcase_test 2 3 import ( 4 "testing" 5 6 "gotest.tools/v3/assert" 7 8 "cosmossdk.io/client/v2/internal/strcase" 9 ) 10 11 func toKebab(t testing.TB) { 12 cases := [][]string{ 13 {"testCase", "test-case"}, 14 {"TestCase", "test-case"}, 15 {"Test Case", "test-case"}, 16 {"TEST CASE", "test-case"}, 17 {"TESTCase", "test-case"}, 18 {"TESTCASE", "testcase"}, 19 {"TEST_CASE", "test-case"}, 20 {"Bech32", "bech32"}, 21 {"Bech32Address", "bech32-address"}, 22 {"Bech32_Address", "bech32-address"}, 23 {"Bech32Address10", "bech32-address10"}, 24 {"Bech32-Address10", "bech32-address10"}, 25 {"SecondBech32Address10Foo", "second-bech32-address10-foo"}, 26 } 27 for _, i := range cases { 28 in := i[0] 29 out := i[1] 30 result := strcase.ToKebab(in) 31 assert.Equal(t, out, result, "ToKebab(%s) = %s, want %s", in, result, out) 32 } 33 } 34 35 func TestToKebab(t *testing.T) { 36 toKebab(t) 37 } 38 39 func BenchmarkToKebab(b *testing.B) { 40 for n := 0; n < b.N; n++ { 41 toKebab(b) 42 } 43 }