use testify's assert on modeltestlib tests (#12676)

Этот коммит содержится в:
Alfian Dhimas Nur Marita
2019-10-11 16:58:19 +07:00
коммит произвёл Jesús Espino
родитель def68212a8
Коммит f70d660225

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

@@ -4,48 +4,31 @@
package model package model
import ( import (
"runtime/debug"
"testing" "testing"
"github.com/stretchr/testify/assert"
) )
func CheckInt(t *testing.T, got int, expected int) { func CheckInt(t *testing.T, got int, expected int) {
if got != expected { assert.Equal(t, got, expected)
debug.PrintStack()
t.Fatalf("Got: %v, Expected: %v", got, expected)
}
} }
func CheckInt64(t *testing.T, got int64, expected int64) { func CheckInt64(t *testing.T, got int64, expected int64) {
if got != expected { assert.Equal(t, got, expected)
debug.PrintStack()
t.Fatalf("Got: %v, Expected: %v", got, expected)
}
} }
func CheckString(t *testing.T, got string, expected string) { func CheckString(t *testing.T, got string, expected string) {
if got != expected { assert.Equal(t, got, expected)
debug.PrintStack()
t.Fatalf("Got: %v, Expected: %v", got, expected)
}
} }
func CheckTrue(t *testing.T, test bool) { func CheckTrue(t *testing.T, test bool) {
if !test { assert.True(t, test)
debug.PrintStack()
t.Fatal("Expected true")
}
} }
func CheckFalse(t *testing.T, test bool) { func CheckFalse(t *testing.T, test bool) {
if test { assert.False(t, test)
debug.PrintStack()
t.Fatal("Expected true")
}
} }
func CheckBool(t *testing.T, got bool, expected bool) { func CheckBool(t *testing.T, got bool, expected bool) {
if got != expected { assert.Equal(t, got, expected)
debug.PrintStack()
t.Fatalf("Got: %v, Expected: %v", got, expected)
}
} }