Exemplo n.º 1
0
func (rp *rewritePackage) keyValueExprTFunc(keyValueExpr *ast.KeyValueExpr) {
	if key, ok := keyValueExpr.Key.(*ast.BasicLit); ok {
		keyValueExpr.Key = rp.wrapBasicLitWithT(key)
	}

	if value, ok := keyValueExpr.Value.(*ast.BasicLit); ok {
		keyValueExpr.Value = rp.wrapBasicLitWithT(value)
	}
}
/*
 * replaces named *testing.T inside a composite literal
 */
func replaceNamedTestingTsInKeyValueExpression(kve *ast.KeyValueExpr, testingT string) {
	ident, ok := kve.Value.(*ast.Ident)
	if !ok {
		return
	}

	if ident.Name == testingT {
		kve.Value = newGinkgoTFromIdent(ident)
	}
}