From 744fbbcb1db2f5b43c81fb41c44b23d219864bcd Mon Sep 17 00:00:00 2001 From: Jonathan Hall Date: Thu, 23 Nov 2023 09:57:28 +0100 Subject: [PATCH] Add a simple test for the sql.Connector interface implementation --- db_test.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/db_test.go b/db_test.go index 18c75dc..85a6e75 100644 --- a/db_test.go +++ b/db_test.go @@ -44,6 +44,18 @@ func drivers() []string { return all } +func TestShouldWorkWithOpenDB(t *testing.T) { + t.Parallel() + for _, d := range txDrivers { + db := sql.OpenDB(txdb.New(d.driver, d.dsn)) + defer db.Close() + _, err := db.Exec("SELECT 1") + if err != nil { + t.Fatal(err) + } + } +} + func TestShouldRunWithNestedTransaction(t *testing.T) { t.Parallel() for _, driver := range drivers() {