| 1 | //go:build ignore |
|---|---|
| 2 | // +build ignore |
| 3 | |
| 4 | package 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 | |
| 11 | import "testing" |
| 12 | |
| 13 | func 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 | |
| 18 | func Test(t *testing.T) { |
| 19 | // Don't assert @pointsto(t) since its label contains a fragile line number. |
| 20 | log(Test) |
| 21 | } |
| 22 | |
| 23 | func TestFoo(t *testing.T) { |
| 24 | // Don't assert @pointsto(t) since its label contains a fragile line number. |
| 25 | log(TestFoo) |
| 26 | } |
| 27 | |
| 28 | func TestingQuux(t *testing.T) { |
| 29 | // We can't assert @pointsto(t) since this is dead code. |
| 30 | log(TestingQuux) |
| 31 | } |
| 32 | |
| 33 | func BenchmarkFoo(b *testing.B) { |
| 34 | } |
| 35 | |
| 36 | func 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 |
Members