catch possibles errors in tests

This commit is contained in:
Duke 2015-04-14 01:22:56 -03:00
parent 715739b747
commit 2a9fedd438

View File

@ -29,7 +29,10 @@ func testList(t *testing.T, list *goquery.Selection) {
} }
func readme() []byte { func readme() []byte {
input, _ := ioutil.ReadFile("./README.md") input, err := ioutil.ReadFile("./README.md")
if err != nil {
panic(err)
}
html := append([]byte("<body>"), blackfriday.MarkdownCommon(input)...) html := append([]byte("<body>"), blackfriday.MarkdownCommon(input)...)
html = append(html, []byte("</body>")...) html = append(html, []byte("</body>")...)
return html return html
@ -37,7 +40,10 @@ func readme() []byte {
func startQuery() *goquery.Document { func startQuery() *goquery.Document {
buf := bytes.NewBuffer(readme()) buf := bytes.NewBuffer(readme())
query, _ := goquery.NewDocumentFromReader(buf) query, err := goquery.NewDocumentFromReader(buf)
if err != nil {
panic(err)
}
return query return query
} }