(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func 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 | |
| 61 | func TestToCamelCaseWithDigits(t *testing.T) { |
| 62 | tests := []struct { |
nothing calls this directly
no test coverage detected