1
0
mirror of https://github.com/zhashkevych/go-sqlxmock.git synced 2025-06-12 21:47:29 +02:00
This commit is contained in:
gedi
2014-04-21 18:21:28 +03:00
parent 2e154ee410
commit fa31f407df
3 changed files with 36 additions and 3 deletions

View File

@ -7,6 +7,22 @@ import (
"time"
)
// test the case when db is not triggered and expectations
// are not asserted on close
func TestIssue4(t *testing.T) {
db, err := New()
if err != nil {
t.Errorf("an error '%s' was not expected when opening a stub database connection", err)
}
ExpectQuery("some sql query which will not be called").
WillReturnRows(NewRows([]string{"id"}))
err = db.Close()
if err == nil {
t.Errorf("Was expecting an error, since expected query was not matched")
}
}
func TestMockQuery(t *testing.T) {
db, err := sql.Open("mock", "")
if err != nil {