add more case for filterProfile method

This commit is contained in:
jichangjun 2020-09-05 18:49:29 +08:00
parent ff8f840b14
commit a02988fb3a
2 changed files with 11 additions and 1 deletions

View File

@ -36,7 +36,7 @@ func TestClientAction(t *testing.T) {
profileMockResponse := []byte("mode: count\nmockService/main.go:30.13,48.33 13 1\nb/b.go:30.13,48.33 13 1")
profileSuccessMockSvr := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write(profileMockResponse)
_, _ = w.Write(profileMockResponse)
}))
defer profileSuccessMockSvr.Close()

View File

@ -287,6 +287,16 @@ func TestFilterProfile(t *testing.T) {
},
},
},
{
name: "with invalid regular expression",
pattern: []string{"(?!a)"},
input: []*cover.Profile{
{
FileName: "some/fancy/gopath/a.go",
},
},
expectErr: true,
},
}
for _, tc := range tcs {