internal/web: adjust test to not require exact error message
Fixes breakage from CL 446115. Change-Id: I54be08987e04d3baaabc22b0450b7492f44bbca2 Reviewed-on: https://go-review.googlesource.com/c/website/+/446655 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Родитель
3cbdc17ec9
Коммит
4fbb06500b
|
@ -5,7 +5,6 @@
|
|||
package web
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
|
@ -93,7 +92,7 @@ func TestTypeScript(t *testing.T) {
|
|||
name: "file not found",
|
||||
path: "/notfound.ts",
|
||||
wantCode: 500,
|
||||
wantBody: fmt.Sprintf("\n\nopen testdata/notfound.ts: %s\n", syscall.ENOENT),
|
||||
wantBody: syscall.ENOENT.Error(),
|
||||
},
|
||||
{
|
||||
name: "syntax error",
|
||||
|
@ -116,8 +115,8 @@ func TestTypeScript(t *testing.T) {
|
|||
if (tt.wantCacheHeader && !gotHeader) || (!tt.wantCacheHeader && gotHeader) {
|
||||
t.Errorf("got cache hit %v but wanted %v", gotHeader, tt.wantCacheHeader)
|
||||
}
|
||||
if diff := cmp.Diff(tt.wantBody, got.Body.String()); diff != "" {
|
||||
t.Errorf("ServeHTTP() mismatch (-want +got):\n%s", diff)
|
||||
if !strings.Contains(got.Body.String(), tt.wantBody) {
|
||||
t.Errorf("ServeHTTP() mismatch (-want +got):\n%s", cmp.Diff(tt.wantBody, got.Body.String()))
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче