From 398ff669d4a0aa25844abb71baece4ac18a61125 Mon Sep 17 00:00:00 2001 From: oldme Date: Fri, 8 Mar 2024 10:15:04 +0800 Subject: [PATCH] up --- .../drivers/mssql/mssql_z_unit_model_test.go | 4 ++-- contrib/drivers/pgsql/pgsql_z_unit_test.go | 20 +++++++++---------- .../sqlite/sqlite_z_unit_model_test.go | 2 +- i18n/gi18n/gi18n_z_unit_test.go | 6 +++--- net/gtcp/gtcp_z_unit_conn_pkg_test.go | 2 +- os/gcfg/gcfg_z_unit_adapter_file_test.go | 4 ++-- os/gtime/gtime_z_unit_test.go | 2 +- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/contrib/drivers/mssql/mssql_z_unit_model_test.go b/contrib/drivers/mssql/mssql_z_unit_model_test.go index 7a809039fc7..fe092043b1c 100644 --- a/contrib/drivers/mssql/mssql_z_unit_model_test.go +++ b/contrib/drivers/mssql/mssql_z_unit_model_test.go @@ -2558,7 +2558,7 @@ func Test_Model_AllAndCount(t *testing.T) { gtest.C(t, func(t *gtest.T) { result, total, err := db.Model(table).Order("id").Limit(0, 3).AllAndCount(false) - t.Assert(err, nil) + t.AssertNil(err) t.Assert(len(result), 3) t.Assert(total, TableSize) @@ -2582,7 +2582,7 @@ func Test_Model_ScanAndCount(t *testing.T) { total := 0 err := db.Model(table).Order("id").Limit(0, 3).ScanAndCount(&users, &total, false) - t.Assert(err, nil) + t.AssertNil(err) t.Assert(len(users), 3) t.Assert(total, TableSize) diff --git a/contrib/drivers/pgsql/pgsql_z_unit_test.go b/contrib/drivers/pgsql/pgsql_z_unit_test.go index 6d9a6f98135..4cdfdabd57c 100644 --- a/contrib/drivers/pgsql/pgsql_z_unit_test.go +++ b/contrib/drivers/pgsql/pgsql_z_unit_test.go @@ -37,12 +37,12 @@ func Test_LastInsertId(t *testing.T) { {"passport": "user2", "password": "pwd", "nickname": "nickname", "create_time": CreateTime}, {"passport": "user3", "password": "pwd", "nickname": "nickname", "create_time": CreateTime}, }) - t.Assert(err, nil) + t.AssertNil(err) lastInsertId, err := res.LastInsertId() - t.Assert(err, nil) + t.AssertNil(err) t.Assert(lastInsertId, int64(3)) rowsAffected, err := res.RowsAffected() - t.Assert(err, nil) + t.AssertNil(err) t.Assert(rowsAffected, int64(3)) }) } @@ -58,29 +58,29 @@ func Test_TxLastInsertId(t *testing.T) { {"passport": "user2", "password": "pwd", "nickname": "nickname", "create_time": CreateTime}, {"passport": "user3", "password": "pwd", "nickname": "nickname", "create_time": CreateTime}, }) - t.Assert(err, nil) + t.AssertNil(err) lastInsertId, err := res.LastInsertId() - t.Assert(err, nil) + t.AssertNil(err) t.AssertEQ(lastInsertId, int64(3)) rowsAffected, err := res.RowsAffected() - t.Assert(err, nil) + t.AssertNil(err) t.AssertEQ(rowsAffected, int64(3)) res1, err := tx.Model(tableName).Insert(g.List{ {"passport": "user4", "password": "pwd", "nickname": "nickname", "create_time": CreateTime}, {"passport": "user5", "password": "pwd", "nickname": "nickname", "create_time": CreateTime}, }) - t.Assert(err, nil) + t.AssertNil(err) lastInsertId1, err := res1.LastInsertId() - t.Assert(err, nil) + t.AssertNil(err) t.AssertEQ(lastInsertId1, int64(5)) rowsAffected1, err := res1.RowsAffected() - t.Assert(err, nil) + t.AssertNil(err) t.AssertEQ(rowsAffected1, int64(2)) return nil }) - t.Assert(err, nil) + t.AssertNil(err) }) } diff --git a/contrib/drivers/sqlite/sqlite_z_unit_model_test.go b/contrib/drivers/sqlite/sqlite_z_unit_model_test.go index c9a242e4c1a..7734bb5b7b9 100644 --- a/contrib/drivers/sqlite/sqlite_z_unit_model_test.go +++ b/contrib/drivers/sqlite/sqlite_z_unit_model_test.go @@ -407,7 +407,7 @@ func Test_Model_Save(t *testing.T) { t.AssertNil(err) err = db.Model(table).Scan(&user) - t.Assert(err, nil) + t.AssertNil(err) t.Assert(user.Passport, "CN") t.Assert(user.Password, "abc123456") t.Assert(user.NickName, "to be not to be") diff --git a/i18n/gi18n/gi18n_z_unit_test.go b/i18n/gi18n/gi18n_z_unit_test.go index 5ef6fc86f10..af44d226bf7 100644 --- a/i18n/gi18n/gi18n_z_unit_test.go +++ b/i18n/gi18n/gi18n_z_unit_test.go @@ -214,7 +214,7 @@ func Test_PathInResource(t *testing.T) { t.Assert(i18n.T(context.Background(), "{#hello}{#world}"), "你好世界") err = i18n.SetPath("i18n") - t.Assert(err, nil) + t.AssertNil(err) i18n.SetLanguage("ja") t.Assert(i18n.T(context.Background(), "{#hello}{#world}"), "こんにちは世界") }) @@ -245,7 +245,7 @@ func Test_PathInNormal(t *testing.T) { i18n.SetLanguage("en") t.Assert(i18n.T(context.Background(), "{#hello}{#world}{#name}"), "HelloWorld{#name}") err := gfile.PutContentsAppend(gfile.Join(gdebug.CallerDirectory(), "manifest/i18n/en.toml"), "\nname = \"GoFrame\"") - t.Assert(err, nil) + t.AssertNil(err) // Wait for the file modification time to change. time.Sleep(10 * time.Millisecond) t.Assert(i18n.T(context.Background(), "{#hello}{#world}{#name}"), "HelloWorldGoFrame") @@ -254,7 +254,7 @@ func Test_PathInNormal(t *testing.T) { // Add new language gtest.C(t, func(t *gtest.T) { err := gfile.PutContents(gfile.Join(gdebug.CallerDirectory(), "manifest/i18n/en-US.toml"), "lang = \"en-US\"") - t.Assert(err, nil) + t.AssertNil(err) // Wait for the file modification time to change. time.Sleep(10 * time.Millisecond) i18n.SetLanguage("en-US") diff --git a/net/gtcp/gtcp_z_unit_conn_pkg_test.go b/net/gtcp/gtcp_z_unit_conn_pkg_test.go index 8b171abe490..19479e3ccd7 100644 --- a/net/gtcp/gtcp_z_unit_conn_pkg_test.go +++ b/net/gtcp/gtcp_z_unit_conn_pkg_test.go @@ -258,7 +258,7 @@ func Test_Package_Option_HeadSize4(t *testing.T) { defer conn.Close() data := make([]byte, 0xFFFF+1) _, err = conn.SendRecvPkg(data, gtcp.PkgOption{HeaderSize: 4}) - t.Assert(err, nil) + t.AssertNil(err) }) // SendRecvPkg with big data - success. gtest.C(t, func(t *gtest.T) { diff --git a/os/gcfg/gcfg_z_unit_adapter_file_test.go b/os/gcfg/gcfg_z_unit_adapter_file_test.go index d44c1f2fcc2..4f46e44ea06 100644 --- a/os/gcfg/gcfg_z_unit_adapter_file_test.go +++ b/os/gcfg/gcfg_z_unit_adapter_file_test.go @@ -155,14 +155,14 @@ func TestAdapterFile_Set(t *testing.T) { path = gcfg.DefaultConfigFileName err = gfile.PutContents(path, config) ) - t.Assert(err, nil) + t.AssertNil(err) defer gfile.Remove(path) c, err := gcfg.New() t.Assert(c.MustGet(ctx, "log-path").String(), "logs") err = c.GetAdapter().(*gcfg.AdapterFile).Set("log-path", "custom-logs") - t.Assert(err, nil) + t.AssertNil(err) t.Assert(c.MustGet(ctx, "log-path").String(), "custom-logs") }) } diff --git a/os/gtime/gtime_z_unit_test.go b/os/gtime/gtime_z_unit_test.go index d7479ff9857..4765f834958 100644 --- a/os/gtime/gtime_z_unit_test.go +++ b/os/gtime/gtime_z_unit_test.go @@ -72,7 +72,7 @@ func Test_Datetime(t *testing.T) { }) gtest.C(t, func(t *gtest.T) { timeTemp, err := gtime.StrToTime("") - t.Assert(err, nil) + t.AssertNil(err) t.AssertLT(timeTemp.Unix(), 0) timeTemp, err = gtime.StrToTime("2006-01") t.AssertNE(err, nil)