diff options
author | EuAndreh <eu@euandre.org> | 2024-10-18 17:54:26 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2024-10-20 03:36:18 -0300 |
commit | f00c41fd4e6af8cd0db80c118a3bb4abef09604e (patch) | |
tree | 46ad14d55cfe591691cf214076e8aea81edbfe18 /tests/functional | |
parent | .gitignore: Remove .so (diff) | |
download | golite-f00c41fd4e6af8cd0db80c118a3bb4abef09604e.tar.gz golite-f00c41fd4e6af8cd0db80c118a3bb4abef09604e.tar.xz |
Shoehorn project into default golang skeleton structure
Diffstat (limited to 'tests/functional')
-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 |
5 files changed, 20 insertions, 33 deletions
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 |