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

Function TestToCamelCaseWithDigits

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

Source from the content-addressed store, hash-verified

59}
60
61func TestToCamelCaseWithDigits(t *testing.T) {
62 tests := []struct {
63 str string
64 want string
65 }{{
66 str: "",
67 want: "",
68 }, {
69 str: " foo_bar ",
70 want: "FooBar",
71 }, {
72 str: "hi hello-hey-hallo",
73 want: "HiHelloHeyHallo",
74 }, {
75 str: "foo#bar",
76 want: "FooBar",
77 }, {
78 str: "foo2bar",
79 want: "Foo2Bar",
80 }, {
81 str: "пир2пир",
82 want: "Пир2Пир",
83 }, {
84 // Test that each substitution works
85 str: "word.word3word-WORD+Word_word~word(Word)Word{Word}Word[Word]Word:Word;",
86 want: "WordWord3WordWORDWordWordWordWordWordWordWordWordWordWord",
87 }, {
88 // Make sure numbers don't interact in a funny way.
89 str: "number-1234",
90 want: "Number1234",
91 },
92 }
93 for i := range tests {
94 tt := tests[i]
95 t.Run(tt.str, func(t *testing.T) {
96 require.Equal(t, tt.want, ToCamelCaseWithDigits(tt.str))
97 })
98 }
99}
100
101func TestToCamelCaseWithInitialisms(t *testing.T) {
102 tests := []struct {

Callers

nothing calls this directly

Calls 2

ToCamelCaseWithDigitsFunction · 0.85
RunMethod · 0.80

Tested by

no test coverage detected