Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Adding line number of caller #20

Closed
owentran opened this issue Jan 4, 2016 · 5 comments
Closed

Adding line number of caller #20

owentran opened this issue Jan 4, 2016 · 5 comments

Comments

@owentran
Copy link

owentran commented Jan 4, 2016

Our team is really enjoying the mock support. Is there a way to get the controller to print the caller class and line number...

For example

--- FAIL: TestGetMany (0.00s)
    controller.go:113: no matching expected call: *lcp_mock.MockOrdersInterface.GetMany([context.Background wpID userID lpID confirmationNumber [statuses] [orderTypes]])
    controller.go:158: missing call(s) to *ids_mock.MockContextService.GetAccessToken(is anything, is anything, is anything)
    controller.go:158: missing call(s) to *lcp_mock.MockOrdersInterface.GetMany(is anything, is equal to accessToken, is equal to userID, is equal to lpID, is equal to confirmationNumber, is equal to [statuses], is equal to [orderTypes])
    controller.go:165: aborting test due to missing call(s)

Instead of controller.go:113 or 158, could the name of the function caller be included in the error message? This would help identify where in the code is actually trying to use the mock.

Thanks for this great library!

@dsymonds
Copy link
Contributor

dsymonds commented Jan 4, 2016

There isn't a way, but that's a perfectly reasonable request. I'll see if I can come up with something.

@ooesili
Copy link

ooesili commented Feb 12, 2016

I made #25 to do this.

Actually... it doesn't do exactly what you asked for, but it does add filenames and line numbers to errors, which seems to suffice.

@zwass
Copy link

zwass commented Aug 23, 2016

@dsymonds Any progress on this? It would be hugely helpful to see both where an expected call was indicated that did not occur, and where a call was made that was not expected. Either one would be a big win but both would be amazing.

@ybbus
Copy link

ybbus commented Jul 11, 2017

Would also like to see this

@balshetzer
Copy link
Collaborator

PR #25 was pulled in via #97 so this issue should be resolved. Please re-open if I misunderstood.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants