github.com/wfusion/gofusion@v1.1.14/test/db/cases/sqlite_test.go (about) 1 package cases 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/stretchr/testify/suite" 8 9 "github.com/wfusion/gofusion/log" 10 11 testDB "github.com/wfusion/gofusion/test/db" 12 ) 13 14 // TestSqlite sqlite lite test cases, it should run in serial mode because sessions are too easy to race 15 func TestSqlite(t *testing.T) { 16 testingSuite := &Sqlite{Test: new(testDB.Test)} 17 testingSuite.Init(testingSuite) 18 suite.Run(t, testingSuite) 19 } 20 21 type Sqlite struct { 22 *testDB.Test 23 } 24 25 func (t *Sqlite) BeforeTest(suiteName, testName string) { 26 t.Catch(func() { 27 log.Info(context.Background(), "right before %s %s", suiteName, testName) 28 }) 29 } 30 31 func (t *Sqlite) AfterTest(suiteName, testName string) { 32 t.Catch(func() { 33 log.Info(context.Background(), "right after %s %s", suiteName, testName) 34 }) 35 } 36 37 func (t *Sqlite) TestConn() { 38 (&Conn{Test: t.Test}).testDefault(nameSqlite, nameSqlite) 39 } 40 41 func (t *Sqlite) TestModel() { 42 (&Model{Test: t.Test}).testDefault(nameSqlite, nameSqlite) 43 } 44 45 func (t *Sqlite) TestScan() { 46 (&Scan{Test: t.Test}).testDefault(nameSqlite, nameSqlite) 47 } 48 49 func (t *Sqlite) TestTableSharding() { 50 (&TableSharding{Test: t.Test}).testDefault(nameSqlite, nameSqlite) 51 } 52 53 func (t *Sqlite) TestTransaction() { 54 (&Transaction{Test: t.Test}).testDefault(nameSqlite, nameSqlite) 55 }