瀏覽代碼

chore: fix test fail (#1669)

* chore: fix test fail

* fix binduri test fail
thinkerou 7 年之前
父節點
當前提交
f463d847c2
共有 2 個文件被更改,包括 4 次插入3 次删除
  1. 1 1
      binding/binding_test.go
  2. 3 2
      recovery_test.go

+ 1 - 1
binding/binding_test.go

@@ -687,7 +687,7 @@ func TestUriBinding(t *testing.T) {
 	}
 	var not NotSupportStruct
 	assert.Error(t, b.BindUri(m, &not))
-	assert.Equal(t, "", not.Name)
+	assert.Equal(t, map[string]interface{}(nil), not.Name)
 }
 
 func testFormBinding(t *testing.T, method, path, badPath, body, badBody string) {

+ 3 - 2
recovery_test.go

@@ -11,6 +11,7 @@ import (
 	"net"
 	"net/http"
 	"os"
+	"strings"
 	"syscall"
 	"testing"
 
@@ -84,7 +85,7 @@ func TestPanicWithBrokenPipe(t *testing.T) {
 	const expectCode = 204
 
 	expectMsgs := map[syscall.Errno]string{
-		syscall.EPIPE:      "Broken pipe",
+		syscall.EPIPE:      "broken pipe",
 		syscall.ECONNRESET: "connection reset by peer",
 	}
 
@@ -108,7 +109,7 @@ func TestPanicWithBrokenPipe(t *testing.T) {
 			w := performRequest(router, "GET", "/recovery")
 			// TEST
 			assert.Equal(t, expectCode, w.Code)
-			assert.Contains(t, buf.String(), expectMsg)
+			assert.Contains(t, strings.ToLower(buf.String()), expectMsg)
 		})
 	}
 }