I've been burned a few times by tests that simply fatal, requiring me to
run another build to learn more about what the mismatch was. Avoid this.

This is part of a long running goal of mine to make testing "better".
Этот коммит содержится в:
Jesse Hallam
2018-08-09 05:26:38 -04:00
коммит произвёл Jesús Espino
родитель 0bbabd137b
Коммит d8c8a19d35
18 изменённых файлов: 153 добавлений и 362 удалений

Просмотреть файл

@@ -34,18 +34,14 @@ func TestAppError(t *testing.T) {
err := NewAppError("TestAppError", "message", nil, "", http.StatusInternalServerError)
json := err.ToJson()
rerr := AppErrorFromJson(strings.NewReader(json))
if err.Message != rerr.Message {
t.Fatal()
}
require.Equal(t, err.Message, rerr.Message)
t.Log(err.Error())
}
func TestAppErrorJunk(t *testing.T) {
rerr := AppErrorFromJson(strings.NewReader("<html><body>This is a broken test</body></html>"))
if "body: <html><body>This is a broken test</body></html>" != rerr.DetailedError {
t.Fatal()
}
require.Equal(t, "body: <html><body>This is a broken test</body></html>", rerr.DetailedError)
}
func TestCopyStringMap(t *testing.T) {
@@ -173,9 +169,7 @@ func TestValidLower(t *testing.T) {
func TestEtag(t *testing.T) {
etag := Etag("hello", 24)
if len(etag) <= 0 {
t.Fatal()
}
require.NotEqual(t, "", etag)
}
var hashtags = map[string]string{