github.com/vedicsoft/migrate@v3.0.2-0.20170709175710-23a2745a3ade+incompatible/util_test.go (about) 1 package migrate 2 3 import ( 4 nurl "net/url" 5 "testing" 6 ) 7 8 func TestSuintPanicsWithNegativeInput(t *testing.T) { 9 defer func() { 10 if r := recover(); r == nil { 11 t.Fatal("expected suint to panic for -1") 12 } 13 }() 14 suint(-1) 15 } 16 17 func TestSuint(t *testing.T) { 18 if u := suint(0); u != 0 { 19 t.Fatalf("expected 0, got %v", u) 20 } 21 } 22 23 func TestFilterCustomQuery(t *testing.T) { 24 n, err := nurl.Parse("foo://host?a=b&x-custom=foo&c=d") 25 if err != nil { 26 t.Fatal(err) 27 } 28 nx := FilterCustomQuery(n).Query() 29 if nx.Get("x-custom") != "" { 30 t.Fatalf("didn't expect x-custom") 31 } 32 }