Debian Codegraph @

internal/passes/buildir/buildir_test.go

raw
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 "golang.org/x/tools/go/analysis/analysistest"
13 "honnef.co/go/tools/internal/passes/buildir"
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 a._ a._]`
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 }