MCPcopy Index your code
hub / github.com/conventionalcommit/commitlint / TestCheck_AllFormats

Function TestCheck_AllFormats

internal/casing/casing_test.go:137–195  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestCheck_AllFormats(t *testing.T) {
138 for _, tc := range []struct {
139 format string
140 pass []string
141 fail []string
142 }{
143 {
144 casing.Lower,
145 []string{"", "feat", "my feat"},
146 []string{"Feat", "FEAT"},
147 },
148 {
149 casing.Upper,
150 []string{"", "FEAT", "MY FEAT"},
151 []string{"feat", "Feat"},
152 },
153 {
154 casing.Camel,
155 []string{"", "feat", "myFeature"},
156 []string{"MyFeature", "my-feature"},
157 },
158 {
159 casing.Kebab,
160 []string{"", "feat", "my-feature"},
161 []string{"MyFeature", "my_feature"},
162 },
163 {
164 casing.Pascal,
165 []string{"", "Feat", "MyFeature"},
166 []string{"feat", "my_feature"},
167 },
168 {
169 casing.Sentence,
170 []string{"", "Feat", "My feat"},
171 []string{"feat", "My Feat"},
172 },
173 {
174 casing.Snake,
175 []string{"", "feat", "my_feature"},
176 []string{"MyFeature", "my-feature"},
177 },
178 {
179 casing.Start,
180 []string{"", "Feat", "My Feature"},
181 []string{"feat", "my feature"},
182 },
183 } {
184 for _, s := range tc.pass {
185 if !casing.Check(s, tc.format) {
186 t.Errorf("Check(%q, %q) = false, want true", s, tc.format)
187 }
188 }
189 for _, s := range tc.fail {
190 if casing.Check(s, tc.format) {
191 t.Errorf("Check(%q, %q) = true, want false", s, tc.format)
192 }
193 }
194 }

Callers

nothing calls this directly

Calls 1

CheckFunction · 0.92

Tested by

no test coverage detected