1
0
mirror of https://github.com/volatiletech/authboss.git synced 2024-11-28 08:58:38 +02:00

Variable 'delete' collides with builtin function

This commit is contained in:
frederikhors 2020-01-29 14:59:47 +01:00
parent 4d85b23e8a
commit e4d1e16935

View File

@ -12,7 +12,7 @@ func TestRouter(t *testing.T) {
t.Parallel() t.Parallel()
r := NewRouter() r := NewRouter()
var get, post, delete string var get, post, del string
wantGet, wantPost, wantDelete := "testget", "testpost", "testdelete" wantGet, wantPost, wantDelete := "testget", "testpost", "testdelete"
r.Get("/test", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { r.Get("/test", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@ -37,7 +37,7 @@ func TestRouter(t *testing.T) {
panic(err) panic(err)
} }
delete = string(b) del = string(b)
})) }))
wr := httptest.NewRecorder() wr := httptest.NewRecorder()
@ -46,8 +46,8 @@ func TestRouter(t *testing.T) {
if get != wantGet { if get != wantGet {
t.Error("want:", wantGet, "got:", get) t.Error("want:", wantGet, "got:", get)
} }
if len(post) != 0 || len(delete) != 0 { if len(post) != 0 || len(del) != 0 {
t.Error("should be empty:", post, delete) t.Error("should be empty:", post, del)
} }
wr = httptest.NewRecorder() wr = httptest.NewRecorder()
@ -56,15 +56,15 @@ func TestRouter(t *testing.T) {
if post != wantPost { if post != wantPost {
t.Error("want:", wantPost, "got:", post) t.Error("want:", wantPost, "got:", post)
} }
if len(delete) != 0 { if len(del) != 0 {
t.Error("should be empty:", delete) t.Error("should be empty:", del)
} }
wr = httptest.NewRecorder() wr = httptest.NewRecorder()
req = httptest.NewRequest("DELETE", "/test", strings.NewReader("testdelete")) req = httptest.NewRequest("DELETE", "/test", strings.NewReader("testdelete"))
r.ServeHTTP(wr, req) r.ServeHTTP(wr, req)
if delete != wantDelete { if del != wantDelete {
t.Error("want:", wantDelete, "got:", delete) t.Error("want:", wantDelete, "got:", del)
} }
} }