MCPcopy Index your code
hub / github.com/oapi-codegen/oapi-codegen / TestToCamelCase

Function TestToCamelCase

pkg/codegen/utils_test.go:24–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

22)
23
24func TestToCamelCase(t *testing.T) {
25 tests := []struct {
26 str string
27 want string
28 }{{
29 str: "",
30 want: "",
31 }, {
32 str: " foo_bar ",
33 want: "FooBar",
34 }, {
35 str: "hi hello-hey-hallo",
36 want: "HiHelloHeyHallo",
37 }, {
38 str: "foo#bar",
39 want: "FooBar",
40 }, {
41 str: "foo2bar",
42 want: "Foo2bar",
43 }, {
44 // Test that each substitution works
45 str: "word.word-WORD+Word_word~word(Word)Word{Word}Word[Word]Word:Word;",
46 want: "WordWordWORDWordWordWordWordWordWordWordWordWordWord",
47 }, {
48 // Make sure numbers don't interact in a funny way.
49 str: "number-1234",
50 want: "Number1234",
51 },
52 }
53 for i := range tests {
54 tt := tests[i]
55 t.Run(tt.str, func(t *testing.T) {
56 require.Equal(t, tt.want, ToCamelCase(tt.str))
57 })
58 }
59}
60
61func TestToCamelCaseWithDigits(t *testing.T) {
62 tests := []struct {

Callers

nothing calls this directly

Calls 2

ToCamelCaseFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected