MCPcopy Create free account
hub / github.com/goadesign/goa / TestKebabCase

Function TestKebabCase

codegen/funcs_test.go:75–103  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

73}
74
75func TestKebabCase(t *testing.T) {
76 cases := map[string]struct {
77 str string
78 expected string
79 }{
80 "all lower": {"aaa", "aaa"},
81 "start upper": {"Aaa", "aaa"},
82 "start upper 2": {"AAAaa", "aa-aaa"},
83 "mid upper": {"aAa", "a-aa"},
84 "end upper": {"aaA", "aa-a"},
85 "sequential uppers": {"aaAAaa", "aa-a-aaa"},
86 "sequential uppers 2": {"aaAAAa", "aa-aa-aa"},
87 "end sequential uppers": {"aaAA", "aa-aa"},
88 "multiple_uppers": {"aaAaaAaa", "aa-aaa-aaa"},
89 "underscores": {"aa_Aaa_Aaa", "aa-aaa-aaa"},
90 "underscores 2": {"aa_AAaaAA_Aaa", "aa-a-aaa-aa-aaa"},
91 "dashes": {"aa-Aaa-Aaa", "aa-aaa-aaa"},
92 "dashes 2": {"aa-AAaaAA-Aaa", "aa-a-aaa-aa-aaa"},
93 "numbers": {"aa1", "aa1"},
94 }
95 for k, tc := range cases {
96 t.Run(k, func(t *testing.T) {
97 actual := KebabCase(tc.str)
98 if actual != tc.expected {
99 t.Errorf("got %q, expected %q", actual, tc.expected)
100 }
101 })
102 }
103}
104
105func TestWrapText(t *testing.T) {
106 cases := map[string]struct {

Callers

nothing calls this directly

Calls 2

KebabCaseFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected