Files
upstream-centrifugo/internal/gen/utils_test.go
upstream-mirror b352a9a30d
Some checks failed
test / Lint (push) Failing after 3s
test / Test with Go 1.26.8 (push) Failing after 2s
snapshot of https://github.com/centrifugal/centrifugo.git (master, 2026-09-16; blobs > 131072B omitted)
2026-09-16 01:17:21 +05:00

29 lines
560 B
Go

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)
})
}
}