Documentation
¶
Index ¶
- Variables
- func ContainsDirectory(files []os.FileInfo) bool
- func ContainsGoFile(files []os.FileInfo) bool
- func CopyFile(path string, out io.Writer) error
- func CreateBoolIdent(v bool) *ast.Ident
- func CreateMemorizedFuncCall(filename string, line int, pos token.Pos, n *ast.CallExpr, returnType string) *ast.CallExpr
- func CreatePosValuePairExpr(ps []printExpr) []ast.Expr
- func CreateRawStringLit(s string) ast.Expr
- func CreateReflectBoolExpr(rv ast.Expr) *ast.CallExpr
- func CreateReflectInterfaceExpr(rv ast.Expr) *ast.CallExpr
- func CreateReflectTypeExprFromTypeExpr(t ast.Expr) ast.Expr
- func CreateReflectTypeOfExpr(v ast.Expr) *ast.CallExpr
- func CreateReflectValueOfExpr(v ast.Expr) *ast.CallExpr
- func CreateUntypedCallExprFromBuiltinCallExpr(n *ast.CallExpr) *ast.CallExpr
- func CreateUntypedExprFromBinaryExpr(n *ast.BinaryExpr) ast.Expr
- func CreateUntypedExprFromUnaryExpr(n *ast.UnaryExpr) ast.Expr
- func DeterminantExprOfIsTypeConversion(e ast.Expr) ast.Expr
- func DropGopwtEmpower(a *ast.File) (dropped bool)
- func ExtractPrintExprs(typesInfo *types.Info, filename string, line int, offset token.Pos, ...) []printExpr
- func FprintCode(out io.Writer, n ast.Node) error
- func GetAssertImport(a *ast.File) *ast.ImportSpec
- func GetTypeInfo(pkgDir, importPath, tempGoSrcDir string, fset *token.FileSet, ...) (*types.Info, error)
- func HandleGlobalOrLocalImportPath(globalOrLocalImportPath string) (importpath, _filepath string, err error)
- func InspectAssert(root ast.Node, fn func(*ast.CallExpr))
- func IsAssert(x *ast.Ident, c *ast.CallExpr) bool
- func IsBuildableFileName(name string) bool
- func IsBuildableFileSet(s *token.FileSet) bool
- func IsBuiltinFunc(n *ast.CallExpr) bool
- func IsEqualExpr(expr ast.Expr) bool
- func IsGoFileName(name string) bool
- func IsMapType(n ast.Node) bool
- func IsRawStringLit(n *ast.BasicLit) bool
- func IsReflectDeepEqual(expr ast.Expr) bool
- func IsTestGoFileName(name string) bool
- func IsTypeConversion(info *types.Info, e *ast.CallExpr) bool
- func Must(err error)
- func ReplaceAllRawStringLitByStringLit(root ast.Node)
- func ReplaceBinaryExpr(parent ast.Node, oldExpr *ast.BinaryExpr, newExpr ast.Expr)
- func ReplaceUnaryExpr(parent ast.Node, oldExpr *ast.UnaryExpr, newExpr ast.Expr)
- func ResultPosOf(n ast.Expr) token.Pos
- func Rewrite(gopath string, importpath, _filepath string, recursive bool) error
- func RewriteAssert(typesInfo *types.Info, position token.Position, n *ast.CallExpr)
- func RewriteFile(typesInfo *types.Info, fset, originalFset *token.FileSet, ...) error
- func SprintCode(n ast.Node) string
Constants ¶
This section is empty.
Variables ¶
var ( AssertImportIdent = &ast.Ident{Name: "assert"} Testdata = "testdata" TermWidth = 0 WorkingDir = "" Verbose = false )
Functions ¶
func ContainsDirectory ¶
func ContainsGoFile ¶
func CreateBoolIdent ¶
func CreateMemorizedFuncCall ¶
func CreateMemorizedFuncCall(filename string, line int, pos token.Pos, n *ast.CallExpr, returnType string) *ast.CallExpr
CreateMemorizedFuncCall creates memorized *ast.CallExpr. f(a, b) -> translatedassert.FRVInterface(translatedassert.MFCall(filename, line, pos, f, translatedassert.RVOf(a), translatedassert.RVOf(b)))
func CreatePosValuePairExpr ¶
func CreateRawStringLit ¶
CreateRawStringLit creates raw string literal(ast.Expr) from string. VALUE:"foo" ---> AST:`foo` VALUE:"foo`bar" ---> AST:`foo` + "`" + `bar` (because we can't escape ` in “)
func CreateReflectTypeExprFromTypeExpr ¶
CreateReflectTypeExprFromTypeExpr create ast of reflect.Type from ast of type.
func CreateUntypedExprFromBinaryExpr ¶
func CreateUntypedExprFromBinaryExpr(n *ast.BinaryExpr) ast.Expr
CreateUntypedExprFromBinaryExpr creates untyped operator-func(translatedassert.Op*()) from BinaryExpr if given BinaryExpr is untyped, returns it.
func CreateUntypedExprFromUnaryExpr ¶ added in v1.1.0
CreateUntypedExprFromUnaryExpr creates untyped operator-func(translatedassert.UnaryOp*()) from UnaryExpr if given UnaryExpr is untyped, returns it.
func DropGopwtEmpower ¶
DropGopwtEmpower drops `gopwt.Empower()` and drops `import "github.com/ToQoz/gopwt"`.
func ExtractPrintExprs ¶
func GetAssertImport ¶
func GetAssertImport(a *ast.File) *ast.ImportSpec
GetAssertImport returns *ast.ImportSpec of "github.com/ToQoz/gopwt/assert" if it is not found, this returns nil
func GetTypeInfo ¶
func IsAssert ¶
IsAssert returns ok if given CallExpr is github.com/ToQoz/gopwt/assert.OK or Require
func IsBuildableFileName ¶
func IsBuildableFileSet ¶
func IsBuiltinFunc ¶
func IsEqualExpr ¶
func IsGoFileName ¶
func IsRawStringLit ¶
func IsReflectDeepEqual ¶
func IsTestGoFileName ¶
func ReplaceAllRawStringLitByStringLit ¶
ReplaceAllRawStringLitByStringLit replaces all raw string literals in root by string literals.
func ReplaceBinaryExpr ¶
ReplaceBinaryExpr replace oldExpr by newExpr in parent
func ReplaceUnaryExpr ¶ added in v1.1.0
ReplaceUnaryExpr replace oldExpr by newExpr in parent
func ResultPosOf ¶
ResultPosOf returns result position of given expr. "a" -> 0 "obj.Fn" -> 3 "1 + 2" -> 2 "(1)" -> 1
func RewriteAssert ¶
RewriteAssert rewrites assert to translatedassert
func RewriteFile ¶
func SprintCode ¶
Types ¶
This section is empty.