gotest.tools icon indicating copy to clipboard operation
gotest.tools copied to clipboard

assert: look for the right function call in the source

Open dnephin opened this issue 4 years ago • 1 comments

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.

dnephin avatar Sep 27 '20 22:09 dnephin

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 com

ghost avatar Jun 30 '21 18:06 ghost