Use memdb for tests. (#131)

This commit is contained in:
Nuno Cruces
2024-08-05 21:25:47 +01:00
committed by GitHub
parent 40db26c1dd
commit 8f835eda79
21 changed files with 154 additions and 70 deletions

View File

@@ -8,15 +8,17 @@ import (
"github.com/ncruces/go-sqlite3/driver"
_ "github.com/ncruces/go-sqlite3/embed"
_ "github.com/ncruces/go-sqlite3/internal/testcfg"
"github.com/ncruces/go-sqlite3/vfs/memdb"
)
func TestDriver(t *testing.T) {
t.Parallel()
tmp := memdb.TestDB(t)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
db, err := driver.Open(":memory:", nil, func(c *sqlite3.Conn) error {
db, err := driver.Open(tmp, nil, func(c *sqlite3.Conn) error {
return c.Exec(`PRAGMA optimize`)
})
if err != nil {