| 1 |
This file tests codelenses for test functions. |
| 2 |
|
| 3 |
TODO: for some reason these code lens have zero width. Does that affect their |
| 4 |
utility/visibility in various LSP clients? |
| 5 |
|
| 6 |
-- settings.json -- |
| 7 |
{ |
| 8 |
"codelenses": { |
| 9 |
"test": true |
| 10 |
} |
| 11 |
} |
| 12 |
|
| 13 |
-- p_test.go -- |
| 14 |
//@codelenses() |
| 15 |
|
| 16 |
package codelens //@codelens(re"()package codelens", "run file benchmarks") |
| 17 |
|
| 18 |
import "testing" |
| 19 |
|
| 20 |
func TestMain(m *testing.M) {} // no code lens for TestMain |
| 21 |
|
| 22 |
func TestFuncWithCodeLens(t *testing.T) { //@codelens(re"()func", "run test") |
| 23 |
} |
| 24 |
|
| 25 |
func thisShouldNotHaveACodeLens(t *testing.T) { //@diag("t ", re"unused parameter") |
| 26 |
println() // nonempty body => "unused parameter" |
| 27 |
} |
| 28 |
|
| 29 |
func BenchmarkFuncWithCodeLens(b *testing.B) { //@codelens(re"()func", "run benchmark") |
| 30 |
} |
| 31 |
|
| 32 |
func helper() {} // expect no code lens |
| 33 |
|
| 34 |
func _() { |
| 35 |
// pacify unusedfunc |
| 36 |
thisShouldNotHaveACodeLens(nil) |
| 37 |
helper() |
| 38 |
} |