GoPLS Viewer

Home|gopls/go/pointer/testdata/a_test.go
1//go:build ignore
2// +build ignore
3
4package a
5
6// This test exercises the synthesis of testmain packages for tests.
7// The test framework doesn't directly let us perform negative
8// assertions (i.e. that TestingQuux isn't called, or that its
9// parameter's PTS is empty) so this test is rather roundabout.
10
11import "testing"
12
13func log(f func(*testing.T)) {
14    // The PTS of f is the set of called tests.  TestingQuux is not present.
15    print(f// @pointsto command-line-arguments.Test | command-line-arguments.TestFoo
16}
17
18func Test(t *testing.T) {
19    // Don't assert @pointsto(t) since its label contains a fragile line number.
20    log(Test)
21}
22
23func TestFoo(t *testing.T) {
24    // Don't assert @pointsto(t) since its label contains a fragile line number.
25    log(TestFoo)
26}
27
28func TestingQuux(t *testing.T) {
29    // We can't assert @pointsto(t) since this is dead code.
30    log(TestingQuux)
31}
32
33func BenchmarkFoo(b *testing.B) {
34}
35
36func ExampleBar() {
37    // Output:
38}
39
40// Excludes TestingQuux.
41// @calls testing.tRunner -> command-line-arguments.Test
42// @calls testing.tRunner -> command-line-arguments.TestFoo
43// @calls (*testing.B).runN -> command-line-arguments.BenchmarkFoo
44// @calls testing.runExample -> command-line-arguments.ExampleBar
45
MembersX
Test.t
TestingQuux
TestingQuux.t
BenchmarkFoo
BenchmarkFoo.b
testing
log
log.f
Test
TestFoo
TestFoo.t
ExampleBar
Members
X