Skip to content

Commit 278a0b9

Browse files
authored
mark fail, mustExec and mustQuery as test helpers (#1488)
1 parent 9c633df commit 278a0b9

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: driver_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -165,13 +165,15 @@ func runTests(t *testing.T, dsn string, tests ...func(dbt *DBTest)) {
165165
}
166166

167167
func (dbt *DBTest) fail(method, query string, err error) {
168+
dbt.Helper()
168169
if len(query) > 300 {
169170
query = "[query too large to print]"
170171
}
171172
dbt.Fatalf("error on %s %s: %s", method, query, err.Error())
172173
}
173174

174175
func (dbt *DBTest) mustExec(query string, args ...interface{}) (res sql.Result) {
176+
dbt.Helper()
175177
res, err := dbt.db.Exec(query, args...)
176178
if err != nil {
177179
dbt.fail("exec", query, err)
@@ -180,6 +182,7 @@ func (dbt *DBTest) mustExec(query string, args ...interface{}) (res sql.Result)
180182
}
181183

182184
func (dbt *DBTest) mustQuery(query string, args ...interface{}) (rows *sql.Rows) {
185+
dbt.Helper()
183186
rows, err := dbt.db.Query(query, args...)
184187
if err != nil {
185188
dbt.fail("query", query, err)

0 commit comments

Comments
 (0)