(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestIsCamelCase(t *testing.T) { |
| 10 | for _, tc := range []struct { |
| 11 | in string |
| 12 | want bool |
| 13 | }{ |
| 14 | {"", true}, // empty always passes |
| 15 | {"feat", true}, // all-lowercase single word |
| 16 | {"myFeature", true}, // classic camelCase |
| 17 | {"parseHTML", true}, // acronym tail is fine (still no separator) |
| 18 | {"myFeat123", true}, // digits allowed |
| 19 | {"MyFeature", false}, // starts uppercase → PascalCase, not camelCase |
| 20 | {"my-feature", false}, // hyphen not allowed |
| 21 | {"my_feature", false}, // underscore not allowed |
| 22 | {"my feature", false}, // space not allowed |
| 23 | } { |
| 24 | got := casing.IsCamelCase(tc.in) |
| 25 | if got != tc.want { |
| 26 | t.Errorf("IsCamelCase(%q) = %v, want %v", tc.in, got, tc.want) |
| 27 | } |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | func TestIsKebabCase(t *testing.T) { |
| 32 | for _, tc := range []struct { |
nothing calls this directly
no test coverage detected