Skip to content

When expectations are not met show received argument values #158

Open
@Stefos

Description

@Stefos

I am trying to test the execution of an UPDATE query. The output of the failed execution is:

there were unfulfilled expectations: there is a remaining expectation which was not matched: ExpectedExec => expecting Exec or ExecContext which:
		  - matches sql: 'UPDATE `issue`'
		  - is with arguments:
		    0 - 3
		    1 - Issue_1_updated
		    2 - Issue_1_updated
		    3 - 
		    4 - 
		    5 - 1
		    6 - true
		    7 - true
		    8 - <nil>
		    9 - {}
		    10 - <nil>
		    11 - 1
		  - should return Result having:
		      LastInsertId: 1
		      RowsAffected: 1
FAIL

I was able to understand what didn't match by playing with sqlmock.AnyArg(). Rather than having to do that it would be helpful to have an output that tells me what values where received as arguments as well, so I can quickly do a visual comparison of what was expected and what were the actual values used.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions