Skip to content

Commit

Permalink
hugolib: Adjust error test to make it pass on Go tip
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Oct 24, 2018
1 parent 2d7709d commit acc14b4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion hugolib/hugo_sites_build_errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package hugolib
import (
"fmt"
"path/filepath"
"runtime"
"strings"
"testing"

Expand Down Expand Up @@ -199,14 +200,23 @@ func TestSiteBuildErrors(t *testing.T) {
},
},
{
// See https://github.com/gohugoio/hugo/issues/5327
name: "Panic in template Execute",
fileType: single,
fileFixer: func(content string) string {
return strings.Replace(content, ".Title", ".Parent.Parent.Parent", 1)
},

assertBuildError: func(a testSiteBuildErrorAsserter, err error) {
assert.Error(err)
assert.Contains(err.Error(), `execute of template failed: panic in Execute`)
// This is fixed in latest Go source
if strings.Contains(runtime.Version(), "devel") {
fe := a.getFileError(err)
assert.Equal(5, fe.LineNumber)
assert.Equal(21, fe.ColumnNumber)
} else {
assert.Contains(err.Error(), `execute of template failed: panic in Execute`)
}
},
},
}
Expand Down

0 comments on commit acc14b4

Please sign in to comment.