gotools/internal/refactor/inline/inline_test.go

// TestData executes test scenarios specified by files in testdata/*.txtar.
func TestData(t *testing.T) {}

// doInlineNote executes an assertion specified by a single
// @inline(re"pattern", want) note in a comment. It finds the first
// match of regular expression 'pattern' on the same line, finds the
// innermost enclosing CallExpr, and inlines it.
//
// Finally it checks that, on success, the transformed file is equal
// to want (a []byte), or on failure that the error message matches
// want (a *Regexp).
func doInlineNote(logf func(string, ...any), pkg *packages.Package, file *ast.File, content []byte, pattern *regexp.Regexp, posn token.Position, want any) error {}

// findFuncByPosition returns the FuncDecl at the specified (package-agnostic) position.
func findFuncByPosition(pkg *packages.Package, posn token.Position) (*ast.FuncDecl, error) {}

const funcName

type testcase

func TestErrors(t *testing.T) {}

func TestBasics(t *testing.T) {}

func TestDuplicable(t *testing.T) {}

func TestExprStmtReduction(t *testing.T) {}

func TestPrecedenceParens(t *testing.T) {}

func TestSubstitution(t *testing.T) {}

func TestTailCallStrategy(t *testing.T) {}

func TestSpreadCalls(t *testing.T) {}

func TestAssignmentCallStrategy(t *testing.T) {}

func TestVariadic(t *testing.T) {}

func TestParameterBindingDecl(t *testing.T) {}

func TestEmbeddedFields(t *testing.T) {}

func TestSubstitutionPreservesArgumentEffectOrder(t *testing.T) {}

func TestNamedResultVars(t *testing.T) {}

func TestSubstitutionPreservesParameterType(t *testing.T) {}

func TestRedundantConversions(t *testing.T) {}

func runTests(t *testing.T, tests []testcase) {}

// checkNoMutation returns a function that, when called,
// asserts that file was not modified since the checkNoMutation call.
func checkNoMutation(file *ast.File) func() {}

// checkTranscode replaces *callee by the results of gob-encoding and
// then decoding it, to test that these operations are lossless.
func checkTranscode(callee *inline.Callee) error {}

// TODO(adonovan): publish this a helper (#61386).
func extractTxtar(ar *txtar.Archive, dir string) error {}

// deepHash computes a cryptographic hash of an ast.Node so that
// if the data structure is mutated, the hash changes.
// It assumes Go variables do not change address.
//
// TODO(adonovan): consider publishing this in the astutil package.
//
// TODO(adonovan): consider a variant that reports where in the tree
// the mutation occurred (obviously at a cost in space).
func deepHash(n ast.Node) any {}