mirror of
https://github.com/status-im/migrate.git
synced 2025-02-23 00:08:06 +00:00
* Let database.Open() use schemeFromURL as well Otherwise it will fail on MySQL DSNs. Moved schemeFromURL into the database package. Also removed databaseSchemeFromURL and sourceSchemeFromURL as they were just calling schemeFromURL. Fixes https://github.com/golang-migrate/migrate/pull/265#issuecomment-522301237 * Moved url functions into internal/url Also merged the test cases. * Add some database tests to improve coverage * Fix suggestions
33 lines
571 B
Go
33 lines
571 B
Go
package migrate
|
|
|
|
import (
|
|
nurl "net/url"
|
|
"testing"
|
|
)
|
|
|
|
func TestSuintPanicsWithNegativeInput(t *testing.T) {
|
|
defer func() {
|
|
if r := recover(); r == nil {
|
|
t.Fatal("expected suint to panic for -1")
|
|
}
|
|
}()
|
|
suint(-1)
|
|
}
|
|
|
|
func TestSuint(t *testing.T) {
|
|
if u := suint(0); u != 0 {
|
|
t.Fatalf("expected 0, got %v", u)
|
|
}
|
|
}
|
|
|
|
func TestFilterCustomQuery(t *testing.T) {
|
|
n, err := nurl.Parse("foo://host?a=b&x-custom=foo&c=d")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
nx := FilterCustomQuery(n).Query()
|
|
if nx.Get("x-custom") != "" {
|
|
t.Fatalf("didn't expect x-custom")
|
|
}
|
|
}
|