1
0
mirror of https://github.com/golang/go synced 2024-11-21 21:24:45 -07:00

net/http: skip some test failed when httpmuxgo121=1

Signed-off-by: guoguangwu <guoguangwug@gmail.com>
This commit is contained in:
guoguangwu 2024-03-06 09:10:59 +08:00
parent 5dcc04aeac
commit 875b8a6bdf
2 changed files with 11 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import (
"encoding/base64" "encoding/base64"
"errors" "errors"
"fmt" "fmt"
"internal/godebug"
"io" "io"
"math" "math"
"mime/multipart" "mime/multipart"
@ -1535,6 +1536,9 @@ func TestSetPathValue(t *testing.T) {
} }
func TestStatus(t *testing.T) { func TestStatus(t *testing.T) {
if godebug.New("httpmuxgo121").Value() == "1" {
t.Skip("skipping test in TestStatus when httpmuxgo121=1")
}
// The main purpose of this test is to check 405 responses and the Allow header. // The main purpose of this test is to check 405 responses and the Allow header.
h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {}) h := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})
mux := NewServeMux() mux := NewServeMux()

View File

@ -8,6 +8,7 @@ package http
import ( import (
"fmt" "fmt"
"internal/godebug"
"net/url" "net/url"
"regexp" "regexp"
"testing" "testing"
@ -71,6 +72,9 @@ type handler struct{ i int }
func (handler) ServeHTTP(ResponseWriter, *Request) {} func (handler) ServeHTTP(ResponseWriter, *Request) {}
func TestFindHandler(t *testing.T) { func TestFindHandler(t *testing.T) {
if godebug.New("httpmuxgo121").Value() == "1" {
t.Skip("skipping test in TestFindHandler when httpmuxgo121=1")
}
mux := NewServeMux() mux := NewServeMux()
for _, ph := range []struct { for _, ph := range []struct {
pat string pat string
@ -133,6 +137,9 @@ func TestEmptyServeMux(t *testing.T) {
} }
func TestRegisterErr(t *testing.T) { func TestRegisterErr(t *testing.T) {
if godebug.New("httpmuxgo121").Value() == "1" {
t.Skip("skipping test in TestRegisterErr when httpmuxgo121=1")
}
mux := NewServeMux() mux := NewServeMux()
h := &handler{} h := &handler{}
mux.Handle("/a", h) mux.Handle("/a", h)