refactor(test): unify assert.Equal usage (#1054)

This commit is contained in:
Eason Lin
2017-08-04 13:45:59 +08:00
committed by Bo-Yi Wu
parent 4b54b86272
commit 81007d2ce0
5 changed files with 57 additions and 57 deletions
+3 -3
View File
@@ -42,7 +42,7 @@ func TestDebugPrint(t *testing.T) {
SetMode(DebugMode)
debugPrint("these are %d %s\n", 2, "error messages")
assert.Equal(t, w.String(), "[GIN-debug] these are 2 error messages\n")
assert.Equal(t, "[GIN-debug] these are 2 error messages\n", w.String())
}
func TestDebugPrintError(t *testing.T) {
@@ -55,7 +55,7 @@ func TestDebugPrintError(t *testing.T) {
assert.Empty(t, w.String())
debugPrintError(errors.New("this is an error"))
assert.Equal(t, w.String(), "[GIN-debug] [ERROR] this is an error\n")
assert.Equal(t, "[GIN-debug] [ERROR] this is an error\n", w.String())
}
func TestDebugPrintRoutes(t *testing.T) {
@@ -83,7 +83,7 @@ func TestDebugPrintWARNINGSetHTMLTemplate(t *testing.T) {
defer teardown()
debugPrintWARNINGSetHTMLTemplate()
assert.Equal(t, w.String(), "[GIN-debug] [WARNING] Since SetHTMLTemplate() is NOT thread-safe. It should only be called\nat initialization. ie. before any route is registered or the router is listening in a socket:\n\n\trouter := gin.Default()\n\trouter.SetHTMLTemplate(template) // << good place\n\n")
assert.Equal(t, "[GIN-debug] [WARNING] Since SetHTMLTemplate() is NOT thread-safe. It should only be called\nat initialization. ie. before any route is registered or the router is listening in a socket:\n\n\trouter := gin.Default()\n\trouter.SetHTMLTemplate(template) // << good place\n\n", w.String())
}
func setup(w io.Writer) {