MCPcopy Create free account
hub / github.com/conventionalcommit/commitlint / TestIsKebabCase

Function TestIsKebabCase

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

Source from the content-addressed store, hash-verified

29}
30
31func TestIsKebabCase(t *testing.T) {
32 for _, tc := range []struct {
33 in string
34 want bool
35 }{
36 {"", true},
37 {"feat", true},
38 {"my-feature", true},
39 {"kebab-case", true},
40 {"v2-api", true}, // digit allowed
41 {"my--feat", true}, // consecutive hyphens: spec doesn't forbid them
42 {"MyFeature", false}, // uppercase
43 {"my_feature", false}, // underscore
44 {"my feature", false}, // space
45 {"MY-FEAT", false}, // uppercase letters
46 } {
47 got := casing.IsKebabCase(tc.in)
48 if got != tc.want {
49 t.Errorf("IsKebabCase(%q) = %v, want %v", tc.in, got, tc.want)
50 }
51 }
52}
53
54func TestIsPascalCase(t *testing.T) {
55 for _, tc := range []struct {

Callers

nothing calls this directly

Calls 1

IsKebabCaseFunction · 0.92

Tested by

no test coverage detected