// TestGenericBodies tests that bodies of generic functions and methods containing // different constructs can be built in BuilderMode(0). // // Each test specifies the contents of package containing a single go file. // Each call print(arg0, arg1, ...) to the builtin print function // in ssa is correlated a comment at the end of the line of the form: // // //@ types(a, b, c) // // where a, b and c are the types of the arguments to the print call // serialized using go/types.Type.String(). // See x/tools/go/expect for details on the syntax. func TestGenericBodies(t *testing.T) { … } // callsTo finds all calls to an SSA value named fname, // and returns a map from each call site to its enclosing function. func callsTo(fns map[*ssa.Function]bool, fname string) map[*ssa.CallCommon]*ssa.Function { … } // matchNotes returns a mapping from call sites (found by callsTo) // to the first "//@ note" comment on the same line. func matchNotes(fset *token.FileSet, notes []*expect.Note, calls map[*ssa.CallCommon]*ssa.Function) map[*ssa.CallCommon]*expect.Note { … } // TestInstructionString tests serializing instructions via Instruction.String(). func TestInstructionString(t *testing.T) { … } func logFunction(t testing.TB, fn *ssa.Function) { … }