From 835c045c92a0ca52e77830e737cb5ef8a50b7007 Mon Sep 17 00:00:00 2001 From: John Date: Wed, 4 Dec 2019 16:21:35 +0800 Subject: [PATCH] fix unit testing case for gdb --- database/gdb/gdb_unit_z_mysql_model_test.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/database/gdb/gdb_unit_z_mysql_model_test.go b/database/gdb/gdb_unit_z_mysql_model_test.go index cbb5ab7c3..e9e8c373e 100644 --- a/database/gdb/gdb_unit_z_mysql_model_test.go +++ b/database/gdb/gdb_unit_z_mysql_model_test.go @@ -364,11 +364,10 @@ func Test_Model_All(t *testing.T) { gtest.Assert(err, nil) gtest.Assert(len(result), INIT_DATA_SIZE) }) - // sql.ErrNoRows gtest.Case(t, func() { result, err := db.Table(table).Where("id<0").All() gtest.Assert(result, nil) - gtest.Assert(err, sql.ErrNoRows) + gtest.Assert(err, nil) }) } @@ -380,10 +379,10 @@ func Test_Model_One(t *testing.T) { gtest.Assert(err, nil) gtest.Assert(record["nickname"].String(), "name_1") }) - // sql.ErrNoRows + gtest.Case(t, func() { record, err := db.Table(table).Where("id", 0).One() - gtest.Assert(err, sql.ErrNoRows) + gtest.Assert(err, nil) gtest.Assert(record, nil) }) } @@ -396,10 +395,10 @@ func Test_Model_Value(t *testing.T) { gtest.Assert(err, nil) gtest.Assert(value.String(), "name_1") }) - // sql.ErrNoRows + gtest.Case(t, func() { value, err := db.Table(table).Fields("nickname").Where("id", 0).Value() - gtest.Assert(err, sql.ErrNoRows) + gtest.Assert(err, nil) gtest.Assert(value, nil) }) }