const dataDir … const tabwidth … var update … var fset … type checkMode … const export … const rawFormat … const normNumber … const idempotent … const allowTypeParams … // format parses src, prints the corresponding AST, verifies the resulting // src is syntactically correct, and returns the resulting src or an error // if any. func format(src []byte, mode checkMode) ([]byte, error) { … } // lineAt returns the line in text starting at offset offs. func lineAt(text []byte, offs int) []byte { … } // checkEqual compares a and b. func checkEqual(aname, bname string, a, b []byte) error { … } func runcheck(t *testing.T, source, golden string, mode checkMode) { … } func check(t *testing.T, source, golden string, mode checkMode) { … } type entry … var data … func TestFiles(t *testing.T) { … } // TestLineComments, using a simple test case, checks that consecutive line // comments are properly terminated with a newline even if the AST position // information is incorrect. func TestLineComments(t *testing.T) { … } // Verify that the printer can be invoked during initialization. func init() { … } // Verify that the printer doesn't crash if the AST contains BadXXX nodes. func TestBadNodes(t *testing.T) { … } // testComment verifies that f can be parsed again after printing it // with its first comment set to comment at any possible source offset. func testComment(t *testing.T, f *ast.File, srclen int, comment *ast.Comment) { … } // Verify that the printer produces a correct program // even if the position information of comments introducing newlines // is incorrect. func TestBadComments(t *testing.T) { … } type visitor … func (v visitor) Visit(n ast.Node) (w ast.Visitor) { … } // idents is an iterator that returns all idents in f via the result channel. func idents(f *ast.File) <-chan *ast.Ident { … } // identCount returns the number of identifiers found in f. func identCount(f *ast.File) int { … } // Verify that the SourcePos mode emits correct //line directives // by testing that position information for matching identifiers // is maintained. func TestSourcePos(t *testing.T) { … } // Verify that the SourcePos mode doesn't emit unnecessary //line directives // before empty lines. func TestIssue5945(t *testing.T) { … } var decls … func TestDeclLists(t *testing.T) { … } var stmts … func TestStmtLists(t *testing.T) { … } func TestBaseIndent(t *testing.T) { … } // TestFuncType tests that an ast.FuncType with a nil Params field // can be printed (per go/ast specification). Test case for issue 3870. func TestFuncType(t *testing.T) { … } // TestChanType tests that the tree for <-(<-chan int), without // ParenExpr, is correctly formatted with parens. // Test case for issue #63362. func TestChanType(t *testing.T) { … } type limitWriter … func (l *limitWriter) Write(buf []byte) (n int, err error) { … } // Test whether the printer stops writing after the first error func TestWriteErrors(t *testing.T) { … } // TestX is a skeleton test that can be filled in for debugging one-off cases. // Do not remove. func TestX(t *testing.T) { … } func TestCommentedNode(t *testing.T) { … } func TestIssue11151(t *testing.T) { … } // If a declaration has multiple specifications, a parenthesized // declaration must be printed even if Lparen is token.NoPos. func TestParenthesizedDecl(t *testing.T) { … } // Verify that we don't print a newline between "return" and its results, as // that would incorrectly cause a naked return. func TestIssue32854(t *testing.T) { … } func TestSourcePosNewline(t *testing.T) { … } // TestEmptyDecl tests that empty decls for const, var, import are printed with // valid syntax e.g "var ()" instead of just "var", which is invalid and cannot // be parsed. func TestEmptyDecl(t *testing.T) { … }