ekster/pkg/rss/rss_1.0_test.go

31 lines
519 B
Go
Raw Permalink Normal View History

2018-04-06 23:29:15 +00:00
package rss
import (
"io/ioutil"
"path/filepath"
"testing"
)
func TestParseRSS(t *testing.T) {
tests := map[string]string{
"rss_1.0": "Golem.de",
}
for test, want := range tests {
name := filepath.Join("testdata", test)
data, err := ioutil.ReadFile(name)
if err != nil {
t.Fatalf("Reading %s: %v", name, err)
}
feed, err := Parse(data)
if err != nil {
t.Fatalf("Parsing %s: %v", name, err)
}
if feed.Title != want {
t.Errorf("%s: got %q, want %q", name, feed.Title, want)
}
}
}