mirror of
https://github.com/miniflux/v2.git
synced 2025-06-27 16:36:00 +00:00
Update vendor dependencies
This commit is contained in:
parent
34a3fe426b
commit
459bb4531f
747 changed files with 89857 additions and 39711 deletions
27
vendor/github.com/lib/pq/encode_test.go
generated
vendored
27
vendor/github.com/lib/pq/encode_test.go
generated
vendored
|
@ -4,7 +4,7 @@ import (
|
|||
"bytes"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"strings"
|
||||
"regexp"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
@ -304,24 +304,27 @@ func TestInfinityTimestamp(t *testing.T) {
|
|||
var err error
|
||||
var resultT time.Time
|
||||
|
||||
expectedErrorStrPrefix := `sql: Scan error on column index 0: unsupported`
|
||||
expectedErrorStrRegexp := regexp.MustCompile(
|
||||
`^sql: Scan error on column index 0(, name "timestamp(tz)?"|): unsupported`)
|
||||
|
||||
type testCases []struct {
|
||||
Query string
|
||||
Param string
|
||||
ExpectedErrStrPrefix string
|
||||
ExpectedVal interface{}
|
||||
Query string
|
||||
Param string
|
||||
ExpectedErrorStrRegexp *regexp.Regexp
|
||||
ExpectedVal interface{}
|
||||
}
|
||||
tc := testCases{
|
||||
{"SELECT $1::timestamp", "-infinity", expectedErrorStrPrefix, "-infinity"},
|
||||
{"SELECT $1::timestamptz", "-infinity", expectedErrorStrPrefix, "-infinity"},
|
||||
{"SELECT $1::timestamp", "infinity", expectedErrorStrPrefix, "infinity"},
|
||||
{"SELECT $1::timestamptz", "infinity", expectedErrorStrPrefix, "infinity"},
|
||||
{"SELECT $1::timestamp", "-infinity", expectedErrorStrRegexp, "-infinity"},
|
||||
{"SELECT $1::timestamptz", "-infinity", expectedErrorStrRegexp, "-infinity"},
|
||||
{"SELECT $1::timestamp", "infinity", expectedErrorStrRegexp, "infinity"},
|
||||
{"SELECT $1::timestamptz", "infinity", expectedErrorStrRegexp, "infinity"},
|
||||
}
|
||||
// try to assert []byte to time.Time
|
||||
for _, q := range tc {
|
||||
err = db.QueryRow(q.Query, q.Param).Scan(&resultT)
|
||||
if !strings.HasPrefix(err.Error(), q.ExpectedErrStrPrefix) {
|
||||
t.Errorf("Scanning -/+infinity, expected error to have prefix %q, got %q", q.ExpectedErrStrPrefix, err)
|
||||
if !q.ExpectedErrorStrRegexp.MatchString(err.Error()) {
|
||||
t.Errorf("Scanning -/+infinity, expected error to match regexp %q, got %q",
|
||||
q.ExpectedErrorStrRegexp, err)
|
||||
}
|
||||
}
|
||||
// yield []byte
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue