1
0
mirror of https://github.com/golang/go synced 2024-11-17 02:34:46 -07:00

go/printer: add missing error checks in tests

This commit is contained in:
Leon Klingele 2019-01-30 18:09:50 +01:00
parent 56c9f8e8cf
commit df571ce03b
No known key found for this signature in database
GPG Key ID: 0C8AF48831EEC211

View File

@ -153,6 +153,10 @@ func runcheck(t *testing.T, source, golden string, mode checkMode) {
// (This is very difficult to achieve in general and for now // (This is very difficult to achieve in general and for now
// it is only checked for files explicitly marked as such.) // it is only checked for files explicitly marked as such.)
res, err = format(gld, mode) res, err = format(gld, mode)
if err != nil {
t.Error(err)
return
}
if err := diff(golden, fmt.Sprintf("format(%s)", golden), gld, res); err != nil { if err := diff(golden, fmt.Sprintf("format(%s)", golden), gld, res); err != nil {
t.Errorf("golden is not idempotent: %s", err) t.Errorf("golden is not idempotent: %s", err)
} }
@ -744,6 +748,9 @@ func TestParenthesizedDecl(t *testing.T) {
const src = "package p; var ( a float64; b int )" const src = "package p; var ( a float64; b int )"
fset := token.NewFileSet() fset := token.NewFileSet()
f, err := parser.ParseFile(fset, "", src, 0) f, err := parser.ParseFile(fset, "", src, 0)
if err != nil {
t.Fatal(err)
}
// print the original package // print the original package
var buf bytes.Buffer var buf bytes.Buffer