Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assert: look for the right function call in the source #210

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

dnephin
Copy link
Member

@dnephin dnephin commented Sep 27, 2020

Fixes #195

Required moving all the tests which used internal/source to external test packages.

When scanning for an ast.CallExpr only consider those that use a ast.SelectorExpr where the name of the X is a gotest.tools package. That way if there are other function calls on the line, it will continue looking for the right call.

This makes the lookup logic more complicated, and will break if someone assigns assert.<func> to a local var. Hopefully that is not a common practice.

So package functions are called with the package selector. For the upcoming internal/source
change to handle multiple functions on a single line.
And change the test for multiple function calls per line, now that the lookup works
So that multiple function calls on the same line do not confuse the source lookup
@dnephin dnephin added the bug label Sep 27, 2020
@dnephin dnephin force-pushed the multiple-call-expr-per-line branch from e86e93a to e12af39 Compare September 27, 2020 22:59
@dnephin dnephin changed the base branch from master to main October 31, 2020 21:59
@ghost

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Panic when calling t.Log(assert.Check())
1 participant