mirror of
https://github.com/glebarez/go-sqlite.git
synced 2025-10-05 15:56:52 +08:00
windows: fix TestPersistPragma.3, updates #67
This commit is contained in:
31
all_test.go
31
all_test.go
@@ -1401,6 +1401,15 @@ func testBindingError(t *testing.T, query func(db *sql.DB, query string, args ..
|
|||||||
|
|
||||||
// https://gitlab.com/cznic/sqlite/-/issues/51
|
// https://gitlab.com/cznic/sqlite/-/issues/51
|
||||||
func TestIssue51(t *testing.T) {
|
func TestIssue51(t *testing.T) {
|
||||||
|
tempDir, err := ioutil.TempDir("", "")
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
os.RemoveAll(tempDir)
|
||||||
|
}()
|
||||||
|
|
||||||
fn := filepath.Join(tempDir, "test_issue51.db")
|
fn := filepath.Join(tempDir, "test_issue51.db")
|
||||||
db, err := sql.Open(driverName, fn)
|
db, err := sql.Open(driverName, fn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1531,10 +1540,15 @@ const charset = "abcdefghijklmnopqrstuvwxyz" +
|
|||||||
|
|
||||||
// https://gitlab.com/cznic/sqlite/-/issues/53
|
// https://gitlab.com/cznic/sqlite/-/issues/53
|
||||||
func TestIssue53(t *testing.T) {
|
func TestIssue53(t *testing.T) {
|
||||||
if err := emptyDir(tempDir); err != nil {
|
tempDir, err := ioutil.TempDir("", "")
|
||||||
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
os.RemoveAll(tempDir)
|
||||||
|
}()
|
||||||
|
|
||||||
wd, err := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -1555,7 +1569,6 @@ func TestIssue53(t *testing.T) {
|
|||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
db.Close()
|
db.Close()
|
||||||
os.Remove(fn)
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
if _, err := db.Exec(`
|
if _, err := db.Exec(`
|
||||||
@@ -1584,10 +1597,15 @@ CREATE TABLE IF NOT EXISTS loginst (
|
|||||||
|
|
||||||
// https://gitlab.com/cznic/sqlite/-/issues/37
|
// https://gitlab.com/cznic/sqlite/-/issues/37
|
||||||
func TestPersistPragma(t *testing.T) {
|
func TestPersistPragma(t *testing.T) {
|
||||||
if err := emptyDir(tempDir); err != nil {
|
tempDir, err := ioutil.TempDir("", "")
|
||||||
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
os.RemoveAll(tempDir)
|
||||||
|
}()
|
||||||
|
|
||||||
wd, err := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@@ -1680,10 +1698,15 @@ func checkPragmas(db *sql.DB, pragmas []pragmaCfg) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestInMemory(t *testing.T) {
|
func TestInMemory(t *testing.T) {
|
||||||
if err := emptyDir(tempDir); err != nil {
|
tempDir, err := ioutil.TempDir("", "")
|
||||||
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
os.RemoveAll(tempDir)
|
||||||
|
}()
|
||||||
|
|
||||||
wd, err := os.Getwd()
|
wd, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
Reference in New Issue
Block a user