From 37044f47f541879ff4577238795c39722fde0eb5 Mon Sep 17 00:00:00 2001 From: Jack Christensen Date: Thu, 26 Aug 2021 21:08:18 -0500 Subject: [PATCH] Remove tests against github.com/lib/pq --- README.md | 2 +- cid_test.go | 5 +---- pgtype_test.go | 1 - testutil/testutil.go | 19 ++++--------------- time_test.go | 16 +--------------- xid_test.go | 5 +---- 6 files changed, 8 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 77d59b31..bc4e72f9 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,4 @@ pgtype implements Go types for over 70 PostgreSQL types. pgtype is the type system underlying the https://github.com/jackc/pgx PostgreSQL driver. These types support the binary format for enhanced performance with pgx. -They also support the database/sql `Scan` and `Value` interfaces and can be used with https://github.com/lib/pq. +They also support the database/sql `Scan` and `Value` interfaces. diff --git a/cid_test.go b/cid_test.go index 50e50cd8..5b1150eb 100644 --- a/cid_test.go +++ b/cid_test.go @@ -19,10 +19,7 @@ func TestCIDTranscode(t *testing.T) { } testutil.TestPgxSuccessfulTranscodeEqFunc(t, pgTypeName, values, eqFunc) - - for _, driverName := range []string{"github.com/lib/pq", "github.com/jackc/pgx/stdlib"} { - testutil.TestDatabaseSQLSuccessfulTranscodeEqFunc(t, driverName, pgTypeName, values, eqFunc) - } + testutil.TestDatabaseSQLSuccessfulTranscodeEqFunc(t, "github.com/jackc/pgx/stdlib", pgTypeName, values, eqFunc) } func TestCIDSet(t *testing.T) { diff --git a/pgtype_test.go b/pgtype_test.go index 85ca55e9..5fd89dcb 100644 --- a/pgtype_test.go +++ b/pgtype_test.go @@ -10,7 +10,6 @@ import ( "github.com/jackc/pgtype" "github.com/jackc/pgx/v4" _ "github.com/jackc/pgx/v4/stdlib" - _ "github.com/lib/pq" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/testutil/testutil.go b/testutil/testutil.go index e7b64b58..5dded2b9 100644 --- a/testutil/testutil.go +++ b/testutil/testutil.go @@ -11,14 +11,11 @@ import ( "github.com/jackc/pgtype" "github.com/jackc/pgx/v4" _ "github.com/jackc/pgx/v4/stdlib" - _ "github.com/lib/pq" ) func MustConnectDatabaseSQL(t testing.TB, driverName string) *sql.DB { var sqlDriverName string switch driverName { - case "github.com/lib/pq": - sqlDriverName = "postgres" case "github.com/jackc/pgx/stdlib": sqlDriverName = "pgx" default: @@ -98,9 +95,7 @@ func TestSuccessfulTranscode(t testing.TB, pgTypeName string, values []interface func TestSuccessfulTranscodeEqFunc(t testing.TB, pgTypeName string, values []interface{}, eqFunc func(a, b interface{}) bool) { TestPgxSuccessfulTranscodeEqFunc(t, pgTypeName, values, eqFunc) - for _, driverName := range []string{"github.com/lib/pq", "github.com/jackc/pgx/stdlib"} { - TestDatabaseSQLSuccessfulTranscodeEqFunc(t, driverName, pgTypeName, values, eqFunc) - } + TestDatabaseSQLSuccessfulTranscodeEqFunc(t, "github.com/jackc/pgx/stdlib", pgTypeName, values, eqFunc) } func TestPgxSuccessfulTranscodeEqFunc(t testing.TB, pgTypeName string, values []interface{}, eqFunc func(a, b interface{}) bool) { @@ -205,9 +200,7 @@ func TestSuccessfulNormalize(t testing.TB, tests []NormalizeTest) { func TestSuccessfulNormalizeEqFunc(t testing.TB, tests []NormalizeTest, eqFunc func(a, b interface{}) bool) { TestPgxSuccessfulNormalizeEqFunc(t, tests, eqFunc) - for _, driverName := range []string{"github.com/lib/pq", "github.com/jackc/pgx/stdlib"} { - TestDatabaseSQLSuccessfulNormalizeEqFunc(t, driverName, tests, eqFunc) - } + TestDatabaseSQLSuccessfulNormalizeEqFunc(t, "github.com/jackc/pgx/stdlib", tests, eqFunc) } func TestPgxSuccessfulNormalizeEqFunc(t testing.TB, tests []NormalizeTest, eqFunc func(a, b interface{}) bool) { @@ -287,16 +280,12 @@ func TestDatabaseSQLSuccessfulNormalizeEqFunc(t testing.TB, driverName string, t func TestGoZeroToNullConversion(t testing.TB, pgTypeName string, zero interface{}) { TestPgxGoZeroToNullConversion(t, pgTypeName, zero) - for _, driverName := range []string{"github.com/lib/pq", "github.com/jackc/pgx/stdlib"} { - TestDatabaseSQLGoZeroToNullConversion(t, driverName, pgTypeName, zero) - } + TestDatabaseSQLGoZeroToNullConversion(t, "github.com/jackc/pgx/stdlib", pgTypeName, zero) } func TestNullToGoZeroConversion(t testing.TB, pgTypeName string, zero interface{}) { TestPgxNullToGoZeroConversion(t, pgTypeName, zero) - for _, driverName := range []string{"github.com/lib/pq", "github.com/jackc/pgx/stdlib"} { - TestDatabaseSQLNullToGoZeroConversion(t, driverName, pgTypeName, zero) - } + TestDatabaseSQLNullToGoZeroConversion(t, "github.com/jackc/pgx/stdlib", pgTypeName, zero) } func TestPgxGoZeroToNullConversion(t testing.TB, pgTypeName string, zero interface{}) { diff --git a/time_test.go b/time_test.go index 0af42b1e..09ca3c4d 100644 --- a/time_test.go +++ b/time_test.go @@ -14,25 +14,11 @@ func TestTimeTranscode(t *testing.T) { &pgtype.Time{Microseconds: 0, Status: pgtype.Present}, &pgtype.Time{Microseconds: 1, Status: pgtype.Present}, &pgtype.Time{Microseconds: 86399999999, Status: pgtype.Present}, + &pgtype.Time{Microseconds: 86400000000, Status: pgtype.Present}, &pgtype.Time{Status: pgtype.Null}, }) } -// Test for transcoding 24:00:00 separately as github.com/lib/pq doesn't seem to support it. -func TestTimeTranscode24HH(t *testing.T) { - pgTypeName := "time" - values := []interface{}{ - &pgtype.Time{Microseconds: 86400000000, Status: pgtype.Present}, - } - - eqFunc := func(a, b interface{}) bool { - return reflect.DeepEqual(a, b) - } - - testutil.TestPgxSuccessfulTranscodeEqFunc(t, pgTypeName, values, eqFunc) - testutil.TestDatabaseSQLSuccessfulTranscodeEqFunc(t, "github.com/jackc/pgx/stdlib", pgTypeName, values, eqFunc) -} - func TestTimeSet(t *testing.T) { type _time time.Time diff --git a/xid_test.go b/xid_test.go index 563ce96e..531867f6 100644 --- a/xid_test.go +++ b/xid_test.go @@ -19,10 +19,7 @@ func TestXIDTranscode(t *testing.T) { } testutil.TestPgxSuccessfulTranscodeEqFunc(t, pgTypeName, values, eqFunc) - - for _, driverName := range []string{"github.com/lib/pq", "github.com/jackc/pgx/stdlib"} { - testutil.TestDatabaseSQLSuccessfulTranscodeEqFunc(t, driverName, pgTypeName, values, eqFunc) - } + testutil.TestDatabaseSQLSuccessfulTranscodeEqFunc(t, "github.com/jackc/pgx/stdlib", pgTypeName, values, eqFunc) } func TestXIDSet(t *testing.T) {