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