diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/acudego.go | 142 | ||||
-rw-r--r-- | tests/benchmarks/exec/acudego.go (renamed from tests/benchmarks/exec.go) | 14 | ||||
l--------- | tests/benchmarks/exec/main.go | 1 | ||||
-rw-r--r-- | tests/benchmarks/query/acudego.go (renamed from tests/benchmarks/query.go) | 14 | ||||
l--------- | tests/benchmarks/query/main.go | 1 | ||||
-rw-r--r-- | tests/functional/json/acudego.go (renamed from tests/functional/json.go) | 12 | ||||
l--------- | tests/functional/json/main.go | 1 | ||||
-rw-r--r-- | tests/functional/libbuild.go | 19 | ||||
-rw-r--r-- | tests/functional/limit/acudego.go (renamed from tests/functional/limit.go) | 20 | ||||
l--------- | tests/functional/limit/main.go | 1 | ||||
-rw-r--r-- | tests/fuzz/api/acudego.go (renamed from tests/fuzz/api.go) | 4 | ||||
l--------- | tests/fuzz/api/main.go | 1 |
12 files changed, 101 insertions, 129 deletions
diff --git a/tests/acudego.go b/tests/acudego.go index cb9e672..de41ca9 100644 --- a/tests/acudego.go +++ b/tests/acudego.go @@ -406,7 +406,7 @@ func TestSimpleError(t *testing.T) { } func TestCorruptDbErrors(t *testing.T) { - dirName, err := ioutil.TempDir("", "acudego") + dirName, err := ioutil.TempDir("", "FIXME") if err != nil { t.Fatal(err) } @@ -420,7 +420,7 @@ func TestCorruptDbErrors(t *testing.T) { f.Write([]byte{1, 2, 3, 4, 5}) f.Close() - db, err := sql.Open("acudego", dbFileName) + db, err := sql.Open(DriverName, dbFileName) if err == nil { _, err = db.Exec("drop table foo") } @@ -436,13 +436,13 @@ func TestCorruptDbErrors(t *testing.T) { } func TestSqlLogicErrors(t *testing.T) { - dirName, err := ioutil.TempDir("", "acudego") + dirName, err := ioutil.TempDir("", "FIXME") if err != nil { t.Fatal(err) } defer os.RemoveAll(dirName) - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Error(err) } @@ -468,7 +468,7 @@ func TestExtendedErrorCodes_ForeignKey(t *testing.T) { } defer os.RemoveAll(dirName) - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Error(err) } @@ -508,7 +508,7 @@ func TestExtendedErrorCodes_NotNull(t *testing.T) { } defer os.RemoveAll(dirName) - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Error(err) } @@ -558,7 +558,7 @@ func TestExtendedErrorCodes_Unique(t *testing.T) { } defer os.RemoveAll(dirName) - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Error(err) } @@ -613,7 +613,7 @@ func TestError_SystemErrno(t *testing.T) { } // open a non-existent database in read-only mode so we get an IO error. - db, err := sql.Open("acudego", "file:nonexistent.db?mode=ro") + db, err := sql.Open(DriverName, "file:nonexistent.db?mode=ro") if err != nil { t.Fatal(err) } @@ -639,7 +639,7 @@ func TestError_SystemErrno(t *testing.T) { } func TestBeginTxCancel(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal(err) } @@ -698,7 +698,7 @@ func TestBeginTxCancel(t *testing.T) { } func TestStmtReadonly(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal(err) } @@ -739,7 +739,7 @@ func TestStmtReadonly(t *testing.T) { } func TestNamedParams(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -829,7 +829,7 @@ func initDatabase(t *testing.T, db *sql.DB, rowCount int64) { } func TestShortTimeout(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal(err) } @@ -851,7 +851,7 @@ func TestShortTimeout(t *testing.T) { } func TestExecContextCancel(t *testing.T) { - db, err := sql.Open("acudego", "file:exec?mode=memory&cache=shared") + db, err := sql.Open(DriverName, "file:exec?mode=memory&cache=shared") if err != nil { t.Fatal(err) } @@ -892,7 +892,7 @@ FROM test_table t1 LEFT OUTER JOIN test_table t2` func TestQueryRowContextCancel(t *testing.T) { // FIXME: too slow - db, err := sql.Open("acudego", "file:query?mode=memory&cache=shared") + db, err := sql.Open(DriverName, "file:query?mode=memory&cache=shared") if err != nil { t.Fatal(err) } @@ -924,7 +924,7 @@ func TestQueryRowContextCancel(t *testing.T) { func TestQueryRowContextCancelParallel(t *testing.T) { // FIXME: too slow - db, err := sql.Open("acudego", "file:parallel?mode=memory&cache=shared") + db, err := sql.Open(DriverName, "file:parallel?mode=memory&cache=shared") if err != nil { t.Fatal(err) } @@ -974,7 +974,7 @@ func TestQueryRowContextCancelParallel(t *testing.T) { } func TestExecCancel(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal(err) } @@ -995,7 +995,7 @@ func TestExecCancel(t *testing.T) { } func doTestOpenContext(t *testing.T, url string) (string, error) { - db, err := sql.Open("acudego", url) + db, err := sql.Open(DriverName, url) if err != nil { return "Failed to open database:", err } @@ -1032,7 +1032,7 @@ func TestFileCopyTruncate(t *testing.T) { tempFilename := TempFilename(t) defer os.Remove(tempFilename) - db, err := sql.Open("acudego", tempFilename) + db, err := sql.Open(DriverName, tempFilename) if err != nil { t.Fatal("open error:", err) } @@ -1125,7 +1125,7 @@ func TestFileCopyTruncate(t *testing.T) { } // test copied file - db, err = sql.Open("acudego", copyFilename) + db, err = sql.Open(DriverName, copyFilename) if err != nil { t.Fatal("open error:", err) } @@ -1188,7 +1188,7 @@ func TestColumnTableName(t *testing.T) { } func TestFTS5(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -1292,27 +1292,6 @@ func TestFTS5(t *testing.T) { } } -func TestMathFunctions(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") - if err != nil { - t.Fatal("Failed to open database:", err) - } - defer db.Close() - - queries := []string{ - `SELECT acos(1)`, - `SELECT log(10, 100)`, - `SELECT power(2, 2)`, - } - - for _, query := range queries { - var result float64 - if err := db.QueryRow(query).Scan(&result); err != nil { - t.Errorf("invoking math function query %q: %v", query, err) - } - } -} - type preUpdateHookDataForTest struct { databaseName string tableName string @@ -1324,7 +1303,7 @@ type preUpdateHookDataForTest struct { func TestSerializeDeserialize(t *testing.T) { // Connect to the source database. - srcDb, err := sql.Open(driverName, "file:src?mode=memory&cache=shared") + srcDb, err := sql.Open(DriverName, "file:src?mode=memory&cache=shared") if err != nil { t.Fatal("Failed to open the source database:", err) } @@ -1335,7 +1314,7 @@ func TestSerializeDeserialize(t *testing.T) { } // Connect to the destination database. - destDb, err := sql.Open(driverName, "file:dst?mode=memory&cache=shared") + destDb, err := sql.Open(DriverName, "file:dst?mode=memory&cache=shared") if err != nil { t.Fatal("Failed to open the destination database:", err) } @@ -1411,7 +1390,7 @@ func TestUnlockNotify(t *testing.T) { tempFilename := TempFilename(t) defer os.Remove(tempFilename) dsn := fmt.Sprintf("file:%s?cache=shared&mode=memory", tempFilename) - db, err := sql.Open("acudego", dsn) + db, err := sql.Open(DriverName, dsn) if err != nil { t.Fatal("Failed to open database:", err) } @@ -1471,7 +1450,7 @@ func TestUnlockNotifyMany(t *testing.T) { tempFilename := TempFilename(t) defer os.Remove(tempFilename) dsn := fmt.Sprintf("file:%s?cache=shared&mode=memory", tempFilename) - db, err := sql.Open("acudego", dsn) + db, err := sql.Open(DriverName, dsn) if err != nil { t.Fatal("Failed to open database:", err) } @@ -1537,7 +1516,7 @@ func TestUnlockNotifyDeadlock(t *testing.T) { tempFilename := TempFilename(t) defer os.Remove(tempFilename) dsn := fmt.Sprintf("file:%s?cache=shared&mode=memory", tempFilename) - db, err := sql.Open("acudego", dsn) + db, err := sql.Open(DriverName, dsn) if err != nil { t.Fatal("Failed to open database:", err) } @@ -1630,7 +1609,7 @@ func TempFilename(t testing.TB) string { } func doTestOpen(t *testing.T, url string) (string, error) { - db, err := sql.Open("acudego", url) + db, err := sql.Open(DriverName, url) if err != nil { return "Failed to open database:", err } @@ -1659,7 +1638,7 @@ func doTestOpen(t *testing.T, url string) (string, error) { func TestOpenWithVFS(t *testing.T) { { uri := fmt.Sprintf("file:%s?mode=memory&vfs=hello", t.Name()) - db, err := sql.Open("acudego", uri) + db, err := sql.Open(DriverName, uri) if err != nil { t.Fatal("Failed to open", err) } @@ -1672,7 +1651,7 @@ func TestOpenWithVFS(t *testing.T) { { uri := fmt.Sprintf("file:%s?mode=memory&vfs=unix-none", t.Name()) - db, err := sql.Open("acudego", uri) + db, err := sql.Open(DriverName, uri) if err != nil { t.Fatal("Failed to open", err) } @@ -1695,7 +1674,7 @@ func TestOpenNoCreate(t *testing.T) { // https://golang.org/pkg/database/sql/#Open // "Open may just validate its arguments without creating a connection // to the database. To verify that the data source name is valid, call Ping." - db, err := sql.Open("acudego", fmt.Sprintf("file:%s?mode=rw", filename)) + db, err := sql.Open(DriverName, fmt.Sprintf("file:%s?mode=rw", filename)) if err == nil { defer db.Close() @@ -1723,7 +1702,7 @@ func TestOpenNoCreate(t *testing.T) { } // verify that it works if the mode is "rwc" instead - db, err = sql.Open("acudego", fmt.Sprintf("file:%s?mode=rwc", filename)) + db, err = sql.Open(DriverName, fmt.Sprintf("file:%s?mode=rwc", filename)) if err != nil { t.Fatal(err) } @@ -1746,14 +1725,14 @@ func TestReadonly(t *testing.T) { tempFilename := TempFilename(t) defer os.Remove(tempFilename) - db1, err := sql.Open("acudego", "file:"+tempFilename) + db1, err := sql.Open(DriverName, "file:"+tempFilename) if err != nil { t.Fatal(err) } defer db1.Close() db1.Exec("CREATE TABLE test (x int, y float)") - db2, err := sql.Open("acudego", "file:"+tempFilename+"?mode=ro") + db2, err := sql.Open(DriverName, "file:"+tempFilename+"?mode=ro") if err != nil { t.Fatal(err) } @@ -1768,7 +1747,7 @@ func TestReadonly(t *testing.T) { func TestDeferredForeignKey(t *testing.T) { fname := TempFilename(t) uri := "file:" + fname + "?_foreign_keys=1&mode=memory" - db, err := sql.Open("acudego", uri) + db, err := sql.Open(DriverName, uri) if err != nil { os.Remove(fname) t.Errorf("sql.Open(\"sqlite3\", %q): %v", uri, err) @@ -1803,7 +1782,7 @@ func TestDeferredForeignKey(t *testing.T) { } func TestClose(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -1827,7 +1806,7 @@ func TestClose(t *testing.T) { } func TestInsert(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -1868,7 +1847,7 @@ func TestUpsert(t *testing.T) { if n < 3024000 { t.Skip("UPSERT requires sqlite3 >= 3.24.0") } - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -1911,7 +1890,7 @@ func TestUpsert(t *testing.T) { } func TestUpdate(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -1974,7 +1953,7 @@ func TestUpdate(t *testing.T) { } func TestDelete(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -2033,7 +2012,7 @@ func TestDelete(t *testing.T) { } func TestBooleanRoundtrip(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -2082,7 +2061,7 @@ func TestBooleanRoundtrip(t *testing.T) { func timezone(t time.Time) string { return t.Format("-07:00") } func TestTimestamp(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -2182,7 +2161,7 @@ func TestTimestamp(t *testing.T) { } func TestBoolean(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -2272,7 +2251,7 @@ func TestBoolean(t *testing.T) { } func TestFloat32(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -2307,7 +2286,7 @@ func TestFloat32(t *testing.T) { } func TestNull(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -2336,7 +2315,7 @@ func TestNull(t *testing.T) { } func TestTransaction(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -2393,7 +2372,7 @@ func TestTransaction(t *testing.T) { } func TestWAL(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -2433,7 +2412,7 @@ func TestWAL(t *testing.T) { func TestTimezoneConversion(t *testing.T) { zones := []string{"UTC", "US/Central", "US/Pacific", "Local"} for _, tz := range zones { - db, err := sql.Open("acudego", "file:tz?mode=memory&_loc="+url.QueryEscape(tz)) + db, err := sql.Open(DriverName, "file:tz?mode=memory&_loc="+url.QueryEscape(tz)) if err != nil { t.Fatal("Failed to open database:", err) } @@ -2527,7 +2506,7 @@ func TestTimezoneConversion(t *testing.T) { // TODO: Execer & Queryer currently disabled // https://github.com/mattn/go-sqlite3/issues/82 func TestExecer(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -2545,7 +2524,7 @@ func TestExecer(t *testing.T) { } func TestQueryer(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -2594,7 +2573,7 @@ func TestQueryer(t *testing.T) { } func TestStress(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -2629,7 +2608,7 @@ func TestDateTimeLocal(t *testing.T) { defer os.Remove(tempFilename) filename1 := tempFilename + "?mode=memory&cache=shared" filename2 := filename1 + "&_loc=" + zone - db1, err := sql.Open("acudego", filename2) + db1, err := sql.Open(DriverName, filename2) if err != nil { t.Fatal("Failed to open database:", err) } @@ -2647,7 +2626,7 @@ func TestDateTimeLocal(t *testing.T) { t.Fatal("Result should have timezone", d) } - db2, err := sql.Open("acudego", filename1) + db2, err := sql.Open(DriverName, filename1) if err != nil { t.Fatal("Failed to open database:", err) } @@ -2672,7 +2651,7 @@ func TestDateTimeLocal(t *testing.T) { } db2.Exec("INSERT INTO foo VALUES(?);", dt) - db3, err := sql.Open("acudego", filename2) + db3, err := sql.Open(DriverName, filename2) if err != nil { t.Fatal("Failed to open database:", err) } @@ -2696,7 +2675,7 @@ func TestVersion(t *testing.T) { } func TestStringContainingZero(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -2754,7 +2733,7 @@ func (t TimeStamp) Value() (driver.Value, error) { } func TestDateTimeNow(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -3038,7 +3017,7 @@ func TestDeclTypes(t *testing.T) { } func TestPinger(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal(err) } @@ -3149,7 +3128,7 @@ func TestSetFileControlInt(t *testing.T) { } func TestNonColumnString(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal(err) } @@ -3169,7 +3148,7 @@ func TestNonColumnString(t *testing.T) { } func TestNilAndEmptyBytes(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal(err) } @@ -3224,7 +3203,7 @@ func TestNilAndEmptyBytes(t *testing.T) { } func TestInsertNilByteSlice(t *testing.T) { - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal(err) } @@ -3245,7 +3224,7 @@ func TestInsertNilByteSlice(t *testing.T) { func TestNamedParam(t *testing.T) { tempFilename := TempFilename(t) defer os.Remove(tempFilename) - db, err := sql.Open("acudego", ":memory:") + db, err := sql.Open(DriverName, ":memory:") if err != nil { t.Fatal("Failed to open database:", err) } @@ -3304,7 +3283,7 @@ var tdb *TestDB func initializeTestDB(t testing.TB) { tempFilename := TempFilename(t) - d, err := sql.Open("acudego", tempFilename+"?mode=memory&cache=shared") + d, err := sql.Open(DriverName, tempFilename+"?mode=memory&cache=shared") if err != nil { os.Remove(tempFilename) t.Fatal(err) @@ -3625,7 +3604,6 @@ func MainTest() { { "TestFileCopyTruncate", TestFileCopyTruncate }, { "TestColumnTableName", TestColumnTableName }, { "TestFTS5", TestFTS5 }, - { "TestMathFunctions", TestMathFunctions }, { "TestSerializeDeserialize", TestSerializeDeserialize }, { "TestOpenWithVFS", TestOpenWithVFS }, { "TestOpenNoCreate", TestOpenNoCreate }, diff --git a/tests/benchmarks/exec.go b/tests/benchmarks/exec/acudego.go index 0a85b1f..79e7992 100644 --- a/tests/benchmarks/exec.go +++ b/tests/benchmarks/exec/acudego.go @@ -1,21 +1,23 @@ -package main +package acudego import ( "database/sql" "flag" - - _ "acudego" ) -var nFlag = flag.Int("n", 1_000_000, "The number of iterations to execute") +var nFlag = flag.Int( + "n", + 1_000_000, + "The number of iterations to execute", +) -func main() { +func MainTest() { flag.Parse() n := *nFlag - db, err := sql.Open("acudego3", "file:bench.db?mode=memory&cache=shared") + db, err := sql.Open(DriverName, "file:bench.db?mode=memory&cache=shared") if err != nil { panic(err) } diff --git a/tests/benchmarks/exec/main.go b/tests/benchmarks/exec/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/benchmarks/exec/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file diff --git a/tests/benchmarks/query.go b/tests/benchmarks/query/acudego.go index e9c7b24..3386576 100644 --- a/tests/benchmarks/query.go +++ b/tests/benchmarks/query/acudego.go @@ -1,21 +1,23 @@ -package main +package acudego import ( "database/sql" "flag" - - _ "acudego" ) -var nFlag = flag.Int("n", 100_000, "The number of iterations to execute") +var nFlag = flag.Int( + "n", + 100_000, + "The number of iterations to execute", +) -func main() { +func MainTest() { flag.Parse() n := *nFlag - db, err := sql.Open("acudego", "file:benchdb?mode=memory&cache=shared") + db, err := sql.Open(DriverName, "file:benchdb?mode=memory&cache=shared") if err != nil { panic(err) } diff --git a/tests/benchmarks/query/main.go b/tests/benchmarks/query/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/benchmarks/query/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file diff --git a/tests/functional/json.go b/tests/functional/json/acudego.go index 352a72c..8f5e923 100644 --- a/tests/functional/json.go +++ b/tests/functional/json/acudego.go @@ -1,4 +1,4 @@ -package main +package acudego import ( "database/sql" @@ -7,10 +7,10 @@ import ( "errors" "log" "os" - - _ "acudego" ) + + type Tag struct { Name string `json:"name"` Place string `json:"place"` @@ -25,11 +25,13 @@ func (t *Tag) Value() (driver.Value, error) { return string(b), err } -func main() { + + +func MainTest() { os.Remove("json.db") defer os.Remove("json.db") - db, err := sql.Open("acudego", "json.db") + db, err := sql.Open(DriverName, "json.db") if err != nil { log.Fatal(err) } diff --git a/tests/functional/json/main.go b/tests/functional/json/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/functional/json/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file diff --git a/tests/functional/libbuild.go b/tests/functional/libbuild.go deleted file mode 100644 index 860aff9..0000000 --- a/tests/functional/libbuild.go +++ /dev/null @@ -1,19 +0,0 @@ -package main - -import ( - "database/sql" - - _ "acudego" -) - -func main() { - db, err := sql.Open("acudego", ":memory:") - if err != nil { - panic(err) - } - - err = db.Close() - if err != nil { - panic(err) - } -} diff --git a/tests/functional/limit.go b/tests/functional/limit/acudego.go index ab726f6..d47dc27 100644 --- a/tests/functional/limit.go +++ b/tests/functional/limit/acudego.go @@ -1,4 +1,4 @@ -package main +package acudego import ( "database/sql" @@ -6,10 +6,10 @@ import ( "log" "os" "strings" - - "acudego" ) + + func createBulkInsertQuery(n int, start int) (string, []any) { values := make([]string, n) args := make([]any, n*2) @@ -37,7 +37,9 @@ func bulkInsert(db *sql.DB, query string, args []any) error { return err } -func main() { + + +func MainTest() { const ( num = 400 smallLimit = 100 @@ -49,9 +51,9 @@ func main() { delete from mylimittable; ` - var conn *acudego.SQLiteConn - sql.Register("sqlite3_with_limit", &acudego.SQLiteDriver{ - ConnectHook: func(c *acudego.SQLiteConn) error { + var conn *SQLiteConn + sql.Register("sqlite3_with_limit", &SQLiteDriver{ + ConnectHook: func(c *SQLiteConn) error { conn = c return nil }, @@ -82,7 +84,7 @@ func main() { } } - conn.SetLimit(acudego.SQLITE_LIMIT_VARIABLE_NUMBER, smallLimit) + conn.SetLimit(SQLITE_LIMIT_VARIABLE_NUMBER, smallLimit) { query, args := createBulkInsertQuery(num, num) err := bulkInsert(db, query, args) @@ -91,7 +93,7 @@ func main() { } } - conn.SetLimit(acudego.SQLITE_LIMIT_VARIABLE_NUMBER, bigLimit) + conn.SetLimit(SQLITE_LIMIT_VARIABLE_NUMBER, bigLimit) { query, args := createBulkInsertQuery(500, num+num) err := bulkInsert(db, query, args) diff --git a/tests/functional/limit/main.go b/tests/functional/limit/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/functional/limit/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file diff --git a/tests/fuzz/api.go b/tests/fuzz/api/acudego.go index 0d6db03..7f8e3a0 100644 --- a/tests/fuzz/api.go +++ b/tests/fuzz/api/acudego.go @@ -1,4 +1,4 @@ -package main +package acudego import ( "os" @@ -20,7 +20,7 @@ func FuzzAPI(f *testing.F) { -func main() { +func MainTest() { fuzzTargets := []testing.InternalFuzzTarget{ { "FuzzAPI", FuzzAPI }, } diff --git a/tests/fuzz/api/main.go b/tests/fuzz/api/main.go new file mode 120000 index 0000000..f67563d --- /dev/null +++ b/tests/fuzz/api/main.go @@ -0,0 +1 @@ +../../main.go
\ No newline at end of file |