8000 Report missing calls file position within test function · Issue #317 · uber-go/mock · GitHub
[go: up one dir, main page]

Skip to content

Report missing calls file position within test function #317

Open

Description

@shagohead

Requested feature
Report missing calls file position within test function.

Why the feature is needed
Currently, missing calls reported file position as controller.go:97. Which is:

  • not a test function address
  • points to file controller.go in current (testing) package, which is wrong, because that file from gomock

This limits usage of file positions in report. Your text editor/IDE cannot use that information and points you to invalid place.

(Optional) Proposed solution

diff --git a/gomock/controller.go b/gomock/controller.go
index 674c329..0600666 100644
--- a/gomock/controller.go
+++ b/gomock/controller.go
@@ -86,6 +86,7 @@ func NewController(t TestReporter, opts ...ControllerOption) *Controller {
 	if !ok {
 		h = &nopTestHelper{t}
 	}
+	h.Helper()
 	ctrl := &Controller{
 		T:             h,
 		expectedCalls: newCallSet(),

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0