22 lines
650 B
Go
22 lines
650 B
Go
package mysql
|
|
|
|
import (
|
|
"git.warky.dev/wdevs/relspecgo/pkg/readers"
|
|
"testing"
|
|
)
|
|
|
|
func TestReaderMapDataType(t *testing.T) {
|
|
r := NewReader(&readers.ReaderOptions{})
|
|
for _, tc := range []struct{ input, want string }{{"varchar(64)", "string"}, {"bigint unsigned", "int64"}, {"datetime", "timestamp"}, {"json", "json"}} {
|
|
if got := r.mapDataType(tc.input); got != tc.want {
|
|
t.Errorf("mapDataType(%q) = %q, want %q", tc.input, got, tc.want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestReaderRequiresConnectionString(t *testing.T) {
|
|
if _, err := NewReader(&readers.ReaderOptions{}).ReadDatabase(); err == nil {
|
|
t.Fatal("expected missing connection string error")
|
|
}
|
|
}
|