mirror of
https://github.com/DATA-DOG/go-sqlmock.git
synced 2025-06-04 23:17:28 +02:00
Fix ExpectedExec Stringer implementation
Sometimes the result is incorrectly set, so the cast that takes place in the String() method returns nil.
This commit is contained in:
parent
c35a79d518
commit
ad48e464a0
@ -230,7 +230,7 @@ func (e *ExpectedExec) String() string {
|
||||
}
|
||||
|
||||
if e.result != nil {
|
||||
res, _ := e.result.(*result)
|
||||
if res, ok := e.result.(*result); ok {
|
||||
msg += "\n - should return Result having:"
|
||||
msg += fmt.Sprintf("\n LastInsertId: %d", res.insertID)
|
||||
msg += fmt.Sprintf("\n RowsAffected: %d", res.rowsAffected)
|
||||
@ -238,6 +238,7 @@ func (e *ExpectedExec) String() string {
|
||||
msg += fmt.Sprintf("\n Error: %s", res.err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if e.err != nil {
|
||||
msg += fmt.Sprintf("\n - should return error: %s", e.err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user