Adds test

This commit is contained in:
Harm Aarts 2013-12-02 14:25:13 +01:00
parent 997070656f
commit b311fe3f8d
1 changed files with 14 additions and 0 deletions

View File

@ -7,6 +7,20 @@ import (
var items []*Item
func Test_NewItem(t *testing.T) {
content, _ := ioutil.ReadFile("testdata/initial.atom")
feed := New(1, true, chanHandler, itemHandler)
err := feed.FetchBytes("http://example.com", content, nil)
if err != nil { t.Error(err) }
content, _ = ioutil.ReadFile("testdata/initial_plus_one_new.atom")
feed.FetchBytes("http://example.com", content, nil)
expected := "Second title"
if expected != items[0].Title {
t.Errorf("Expected %s, got %s", expected, items[0].Title)
}
}
func TestFeed(t *testing.T) {
urilist := []string{
//"http://cyber.law.harvard.edu/rss/examples/sampleRss091.xml", // Non-utf8 encoding.