| 1 |
This test checks that formatting does not run on code that has parse errors. |
| 2 |
|
| 3 |
-- parse.go -- |
| 4 |
package noparse_format //@format(parse) |
| 5 |
|
| 6 |
func _() { |
| 7 |
f() //@diag("f", re"(undefined|undeclared name): f") |
| 8 |
} |
| 9 |
-- @parse -- |
| 10 |
package noparse_format //@format(parse) |
| 11 |
|
| 12 |
func _() { |
| 13 |
f() //@diag("f", re"(undefined|undeclared name): f") |
| 14 |
} |
| 15 |
-- noparse.go -- |
| 16 |
package noparse_format //@format(noparse) |
| 17 |
|
| 18 |
// The nonewvars expectation asserts that the go/analysis framework ran. |
| 19 |
|
| 20 |
func what() { |
| 21 |
var hi func() |
| 22 |
if { hi() //@diag(re"(){", re".*missing.*") |
| 23 |
} |
| 24 |
hi := nil |
| 25 |
} |
| 26 |
-- @noparse -- |
| 27 |
7:5: missing condition in if statement |