You've already forked go-sqlxmock
mirror of
https://github.com/zhashkevych/go-sqlxmock.git
synced 2025-06-18 21:47:43 +02:00
examples
.gitignore
.travis.yml
LICENSE
README.md
argument.go
argument_test.go
driver.go
driver_test.go
expectations.go
expectations_before_go18.go
expectations_before_go18_test.go
expectations_go18.go
expectations_go18_test.go
expectations_go19_test.go
expectations_test.go
go.mod
options.go
query.go
query_test.go
result.go
result_test.go
rows.go
rows_go13_test.go
rows_go18.go
rows_go18_test.go
rows_test.go
sqlmock.go
sqlmock_before_go18.go
sqlmock_before_go18_test.go
sqlmock_go18.go
sqlmock_go18_19.go
sqlmock_go18_test.go
sqlmock_go19.go
sqlmock_go19_test.go
sqlmock_test.go
statement.go
statement_before_go18.go
statement_go18.go
statement_test.go
stubs_test.go
27 lines
540 B
Go
27 lines
540 B
Go
![]() |
// +build !go1.8
|
||
|
|
||
|
package sqlmock
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
func TestSqlmockExpectPingHasNoEffect(t *testing.T) {
|
||
|
db, mock, err := New()
|
||
|
if err != nil {
|
||
|
t.Errorf("an error '%s' was not expected when opening a stub database connection", err)
|
||
|
}
|
||
|
defer db.Close()
|
||
|
|
||
|
e := mock.ExpectPing()
|
||
|
|
||
|
// Methods on the expectation can be called
|
||
|
e.WillDelayFor(time.Hour).WillReturnError(fmt.Errorf("an error"))
|
||
|
|
||
|
if err = mock.ExpectationsWereMet(); err != nil {
|
||
|
t.Errorf("expected no error to be returned, but got '%s'", err)
|
||
|
}
|
||
|
}
|