rename gdebug.TestData* -> gtest.Data*; add UT case for http server

This commit is contained in:
John Guo
2022-03-17 16:58:04 +08:00
parent b3e66d8023
commit bceb5fc7de
34 changed files with 167 additions and 152 deletions

View File

@ -550,7 +550,7 @@ func Test_Scan_JsonAttributes(t *testing.T) {
}
table := "jfy_gift"
array := gstr.SplitAndTrim(gtest.TestDataContent(`issue1380.sql`), ";")
array := gstr.SplitAndTrim(gtest.DataContent(`issue1380.sql`), ";")
for _, v := range array {
if _, err := db.Exec(ctx, v); err != nil {
gtest.Error(err)

View File

@ -10,7 +10,6 @@ import (
"fmt"
"testing"
"github.com/gogf/gf/v2/debug/gdebug"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gfile"
"github.com/gogf/gf/v2/test/gtest"
@ -1644,7 +1643,7 @@ func Test_Table_Relation_With_MultipleDepends1(t *testing.T) {
dropTable("table_b")
dropTable("table_c")
}()
for _, v := range gstr.SplitAndTrim(gfile.GetContents(gdebug.TestDataPath("with_multiple_depends.sql")), ";") {
for _, v := range gstr.SplitAndTrim(gfile.GetContents(gtest.DataPath("with_multiple_depends.sql")), ";") {
if _, err := db.Exec(ctx, v); err != nil {
gtest.Error(err)
}
@ -1716,7 +1715,7 @@ func Test_Table_Relation_With_MultipleDepends2(t *testing.T) {
dropTable("table_b")
dropTable("table_c")
}()
for _, v := range gstr.SplitAndTrim(gfile.GetContents(gdebug.TestDataPath("with_multiple_depends.sql")), ";") {
for _, v := range gstr.SplitAndTrim(gfile.GetContents(gtest.DataPath("with_multiple_depends.sql")), ";") {
if _, err := db.Exec(ctx, v); err != nil {
gtest.Error(err)
}
@ -1803,7 +1802,7 @@ func Test_Table_Relation_With_MultipleDepends_Embedded(t *testing.T) {
dropTable("table_b")
dropTable("table_c")
}()
for _, v := range gstr.SplitAndTrim(gfile.GetContents(gdebug.TestDataPath("with_multiple_depends.sql")), ";") {
for _, v := range gstr.SplitAndTrim(gfile.GetContents(gtest.DataPath("with_multiple_depends.sql")), ";") {
if _, err := db.Exec(ctx, v); err != nil {
gtest.Error(err)
}
@ -1996,7 +1995,7 @@ func Test_With_Feature_Issue1401(t *testing.T) {
table1 = "parcels"
table2 = "parcel_items"
)
array := gstr.SplitAndTrim(gtest.TestDataContent(`issue1401.sql`), ";")
array := gstr.SplitAndTrim(gtest.DataContent(`issue1401.sql`), ";")
for _, v := range array {
if _, err := db.Exec(ctx, v); err != nil {
gtest.Error(err)
@ -2038,7 +2037,7 @@ func Test_With_Feature_Issue1412(t *testing.T) {
table1 = "parcels"
table2 = "items"
)
array := gstr.SplitAndTrim(gtest.TestDataContent(`issue1412.sql`), ";")
array := gstr.SplitAndTrim(gtest.DataContent(`issue1412.sql`), ";")
for _, v := range array {
if _, err := db.Exec(ctx, v); err != nil {
gtest.Error(err)

View File

@ -18,7 +18,6 @@ import (
"github.com/gogf/gf/v2/container/garray"
"github.com/gogf/gf/v2/container/gmap"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/debug/gdebug"
"github.com/gogf/gf/v2/encoding/gjson"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gfile"
@ -2195,7 +2194,7 @@ func Test_Model_FieldsEx_WithReservedWords(t *testing.T) {
gtest.C(t, func(t *gtest.T) {
var (
table = "fieldsex_test_table"
sqlTpcPath = gdebug.TestDataPath("reservedwords_table_tpl.sql")
sqlTpcPath = gtest.DataPath("reservedwords_table_tpl.sql")
sqlContent = gfile.GetContents(sqlTpcPath)
)
t.AssertNE(sqlContent, "")