cmd/schemagen: refactoring
- Replace log.Faltal with error wrapping in schemagen func - Simplify tests, use temp dir and ioutil functions, remove boilerplate code - In test use schemagen keyspace to avoid name conflict with examples - Change template
This commit is contained in:
committed by
Michal Jan Matczuk
parent
39bf42f122
commit
8477485a45
31
cmd/schemagen/camelize_test.go
Normal file
31
cmd/schemagen/camelize_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright (C) 2017 ScyllaDB
|
||||
// Use of this source code is governed by a ALv2-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestCamelize(t *testing.T) {
|
||||
tests := []struct {
|
||||
input string
|
||||
want string
|
||||
}{
|
||||
{"hello", "Hello"},
|
||||
{"_hello", "Hello"},
|
||||
{"__hello", "Hello"},
|
||||
{"hello_", "Hello"},
|
||||
{"hello_world", "HelloWorld"},
|
||||
{"hello__world", "HelloWorld"},
|
||||
{"_hello_world", "HelloWorld"},
|
||||
{"helloWorld", "HelloWorld"},
|
||||
{"HelloWorld", "HelloWorld"},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.input, func(t *testing.T) {
|
||||
if got := camelize(tt.input); got != tt.want {
|
||||
t.Errorf("camelize() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user