mirror of
https://github.com/glebarez/go-sqlite.git
synced 2025-10-06 00:06:56 +08:00
add test, updates #65
This commit is contained in:
24
cgo_test.go
24
cgo_test.go
@@ -2,14 +2,15 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build cgo && cgobench
|
||||
// +build cgo,cgobench
|
||||
//go:build (cgo && cgobench) || ignore || (cgo && cgotest)
|
||||
// +build cgo,cgobench ignore cgo,cgotest
|
||||
|
||||
package sqlite // import "modernc.org/sqlite"
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@@ -201,3 +202,22 @@ func BenchmarkInsertComparative(b *testing.B) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// https://gitlab.com/cznic/sqlite/-/issues/65
|
||||
func TestIssue65CGo(t *testing.T) {
|
||||
tempDir, err := ioutil.TempDir("", "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
defer func() {
|
||||
os.RemoveAll(tempDir)
|
||||
}()
|
||||
|
||||
db, err := sql.Open("sqlite3", filepath.Join(tempDir, "testissue65.sqlite"))
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to open database: %v", err)
|
||||
}
|
||||
|
||||
testIssue65(t, db, false)
|
||||
}
|
||||
|
Reference in New Issue
Block a user