mirror of
https://github.com/vbatts/sl-feeds.git
synced 2024-11-22 15:55:39 +00:00
Vincent Batts
8e97e3d16f
and ability to export to feeds Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
38 lines
573 B
Go
38 lines
573 B
Go
package changelog
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestFeed(t *testing.T) {
|
|
fh, err := os.Open("testdata/ChangeLog.txt")
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
defer fh.Close()
|
|
|
|
e, err := Parse(fh)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
f, err := ToFeed("http://slackware.osuosl.org/slackware64-current/ChangeLog.txt", e)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
rss, err := f.ToRss()
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
//println(rss)
|
|
if len(rss) == 0 {
|
|
t.Error("rss output is empty")
|
|
}
|
|
|
|
if err := f.WriteRss(ioutil.Discard); err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|