1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
package goose
import (
"testing"
)
func Test_title(t *testing.T) {
titleUnmodified := " foobar this - is it | bla ¿ "
title := "foobar this - is it"
c := NewCrawler(GetDefaultConfiguration())
a, err := c.Crawl("<!DOCTYPE html><html><head><title>"+
titleUnmodified+"</title></head></html>", "example.com")
if err != nil {
t.Error(err)
}
if a.TitleUnmodified != titleUnmodified {
t.Error("`" + titleUnmodified + "` is extracted as `" + a.TitleUnmodified + "`")
}
if a.Title != title {
t.Error("`" + a.Title + "` should be `" + title + "`")
}
}
|