Use testify/require instead of testify/assert for tests.
This commit is contained in:
parent
ebcbadef24
commit
5d742837f1
32 changed files with 581 additions and 589 deletions
|
|
@ -8,7 +8,7 @@ import (
|
|||
"github.com/go-jet/jet/tests/.gentestdata/mysql/dvds/table"
|
||||
"github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/model"
|
||||
. "github.com/go-jet/jet/tests/.gentestdata/mysql/test_sample/table"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
|
@ -51,8 +51,8 @@ WHERE link.name = 'Bing';
|
|||
WHERE(Link.Name.EQ(String("Bong"))).
|
||||
Query(db, &links)
|
||||
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, len(links), 1)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, len(links), 1)
|
||||
testutils.AssertDeepEqual(t, links[0], model.Link{
|
||||
ID: 204,
|
||||
URL: "http://bong.com",
|
||||
|
|
@ -198,7 +198,7 @@ WHERE link.id = 201;
|
|||
func TestUpdateWithInvalidModelData(t *testing.T) {
|
||||
defer func() {
|
||||
r := recover()
|
||||
assert.Equal(t, r, "missing struct field for column : id")
|
||||
require.Equal(t, r, "missing struct field for column : id")
|
||||
}()
|
||||
|
||||
setupLinkTableForUpdateTest(t)
|
||||
|
|
@ -239,7 +239,7 @@ func TestUpdateQueryContext(t *testing.T) {
|
|||
dest := []model.Link{}
|
||||
err := updateStmt.QueryContext(ctx, db, &dest)
|
||||
|
||||
assert.Error(t, err, "context deadline exceeded")
|
||||
require.Error(t, err, "context deadline exceeded")
|
||||
}
|
||||
|
||||
func TestUpdateExecContext(t *testing.T) {
|
||||
|
|
@ -257,7 +257,7 @@ func TestUpdateExecContext(t *testing.T) {
|
|||
|
||||
_, err := updateStmt.ExecContext(ctx, db)
|
||||
|
||||
assert.Error(t, err, "context deadline exceeded")
|
||||
require.Error(t, err, "context deadline exceeded")
|
||||
}
|
||||
|
||||
func TestUpdateWithJoin(t *testing.T) {
|
||||
|
|
@ -270,7 +270,7 @@ func TestUpdateWithJoin(t *testing.T) {
|
|||
//fmt.Println(query.DebugSql())
|
||||
|
||||
_, err := query.Exec(db)
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
func setupLinkTableForUpdateTest(t *testing.T) {
|
||||
|
|
@ -285,5 +285,5 @@ func setupLinkTableForUpdateTest(t *testing.T) {
|
|||
VALUES(204, "http://www.bing.com", "Bing", DEFAULT).
|
||||
Exec(db)
|
||||
|
||||
assert.NoError(t, err)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue