github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/internal/passes/buildir/buildir_test.go (about) 1 // Copyright 2018 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package buildir_test 6 7 import ( 8 "fmt" 9 "os" 10 "testing" 11 12 "github.com/amarpal/go-tools/internal/passes/buildir" 13 "golang.org/x/tools/go/analysis/analysistest" 14 ) 15 16 func Test(t *testing.T) { 17 result := analysistest.Run(t, analysistest.TestData(), buildir.Analyzer, "a")[0].Result 18 19 irinfo := result.(*buildir.IR) 20 got := fmt.Sprint(irinfo.SrcFuncs) 21 want := `[a.init a.Fib (a.T).fib]` 22 if got != want { 23 t.Errorf("IR.SrcFuncs = %s, want %s", got, want) 24 for _, f := range irinfo.SrcFuncs { 25 f.WriteTo(os.Stderr) 26 } 27 } 28 }