github.com/powerman/golang-tools@v0.1.11-0.20220410185822-5ad214d8d803/go/callgraph/vta/vta_go117_test.go (about) 1 // Copyright 2021 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 //go:build go1.17 6 // +build go1.17 7 8 package vta 9 10 import ( 11 "testing" 12 13 "github.com/powerman/golang-tools/go/callgraph/cha" 14 "github.com/powerman/golang-tools/go/ssa/ssautil" 15 ) 16 17 func TestVTACallGraphGo117(t *testing.T) { 18 file := "testdata/src/go117.go" 19 prog, want, err := testProg(file) 20 if err != nil { 21 t.Fatalf("couldn't load test file '%s': %s", file, err) 22 } 23 if len(want) == 0 { 24 t.Fatalf("couldn't find want in `%s`", file) 25 } 26 27 g, _ := typePropGraph(ssautil.AllFunctions(prog), cha.CallGraph(prog)) 28 if gs := vtaGraphStr(g); !subGraph(want, gs) { 29 t.Errorf("`%s`: want superset of %v;\n got %v", file, want, gs) 30 } 31 }