Exemplo n.º 1
0
/*
 * rewrite t.Fail() or any other *testing.T method by replacing with T().Fail()
 * This function receives a selector expression (eg: t.Fail()) and
 * the name of the *testing.T param from the function declaration. Rewrites the
 * selector expression in place if the target was a *testing.T
 */
func replaceTestingTsMethodCalls(selectorExpr *ast.SelectorExpr, testingT string) {
	ident, ok := selectorExpr.X.(*ast.Ident)
	if !ok {
		return
	}

	if ident.Name == testingT {
		selectorExpr.X = newGinkgoTFromIdent(ident)
	}
}