Fix handling of dropped error in test

This commit is contained in:
Lars Lehtonen 2023-11-29 00:37:26 -08:00 committed by GitHub
parent 9ca889ba49
commit 26a8ec207f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -335,12 +335,14 @@ var commonTestScriptsParam = testscript.Params{
var info testInfo var info testInfo
// Read the .ready file's JSON into info. // Read the .ready file's JSON into info.
f, err := os.Open(readyFilename) f, err := os.Open(readyFilename)
if err == nil { if err != nil {
err = json.NewDecoder(f).Decode(&info)
f.Close()
} else {
ts.Fatalf("failed to open .ready file: %v", err) ts.Fatalf("failed to open .ready file: %v", err)
} }
err = json.NewDecoder(f).Decode(&info)
if err != nil {
ts.Fatalf("error decoding json: %v", err)
}
f.Close()
for i, s := range info.BaseURLs { for i, s := range info.BaseURLs {
ts.Setenv(fmt.Sprintf("HUGOTEST_BASEURL_%d", i), s) ts.Setenv(fmt.Sprintf("HUGOTEST_BASEURL_%d", i), s)