Skip to content

Commit

Permalink
test(handlers/static): 修正 windows 下的测试错误
Browse files Browse the repository at this point in the history
  • Loading branch information
caixw committed Apr 23, 2024
1 parent 8932797 commit 13dca98
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions handlers/static/static_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"net/http"
"net/url"
"os"
"strings"
"testing"
"time"

Expand All @@ -33,12 +34,16 @@ func TestServeFileHandler(t *testing.T) {
servertest.Get(a, "http://localhost:8080/def/file.txt").
Do(nil).
Status(http.StatusOK).
StringBody("file\n")
BodyFunc(func(a *assert.Assertion, body []byte) {
a.Equal("file", strings.TrimSpace(string(body)))
})

servertest.Get(a, "http://localhost:8080/def/").
Do(nil).
Status(http.StatusOK).
StringBody("default.html\n")
BodyFunc(func(a *assert.Assertion, body []byte) {
a.Equal("default.html", strings.TrimSpace(string(body)))
})

servertest.Get(a, "http://localhost:8080/def").
Do(nil).
Expand Down

0 comments on commit 13dca98

Please sign in to comment.