forked from pressly/goose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
helpers_test.go
27 lines (23 loc) · 688 Bytes
/
helpers_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package goose
import (
"testing"
)
func TestCamelSnake(t *testing.T) {
t.Parallel()
tt := []struct {
in string
camel string
snake string
}{
{in: "Add updated_at to users table", camel: "AddUpdatedAtToUsersTable", snake: "add_updated_at_to_users_table"},
{in: "$()&^%(_--crazy__--input$)", camel: "CrazyInput", snake: "crazy_input"},
}
for _, test := range tt {
if got := camelCase(test.in); got != test.camel {
t.Errorf("unexpected CamelCase for input(%q), got %q, want %q", test.in, got, test.camel)
}
if got := snakeCase(test.in); got != test.snake {
t.Errorf("unexpected snake_case for input(%q), got %q, want %q", test.in, got, test.snake)
}
}
}