gotest.tools
gotest.tools copied to clipboard
assert: look for the right function call in the source
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.
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 aast.SelectorExpr
where the name of theX
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 com