snapshot of https://github.com/centrifugal/centrifugo.git (master, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
28
internal/gen/utils_test.go
Normal file
28
internal/gen/utils_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package gen
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestCamelToSnake(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
expected string
|
||||
}{
|
||||
{"CamelCaseString", "camel_case_string"},
|
||||
{"TestID123", "test_id123"},
|
||||
{"NoChange", "no_change"},
|
||||
{"RPC", "rpc"},
|
||||
{"", ""},
|
||||
{"already_snake_case", "already_snake_case"},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.input, func(t *testing.T) {
|
||||
result := CamelToSnake(tt.input)
|
||||
require.Equal(t, tt.expected, result, "Unexpected result for input: %s", tt.input)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user