1
0
mirror of https://github.com/zhashkevych/go-sqlxmock.git synced 2024-11-16 17:41:57 +02:00
go-sqlxmock/sqlmock_before_go18_test.go
2019-11-06 14:15:28 +00:00

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)
}
}