Runs go fmt on all code.
This commit is contained in:
parent
29bd83be41
commit
7b1a94122f
8
atom.go
8
atom.go
|
@ -109,10 +109,10 @@ func (this *Feed) readAtom(doc *xmlx.Document) (err error) {
|
|||
|
||||
if tn = item.SelectNode(ns, "author"); tn != nil {
|
||||
i.Author = Author{}
|
||||
i.Author.Name = tn.S(ns, "name")
|
||||
i.Author.Uri = tn.S(ns, "uri")
|
||||
i.Author.Email = tn.S(ns, "email")
|
||||
}
|
||||
i.Author.Name = tn.S(ns, "name")
|
||||
i.Author.Uri = tn.S(ns, "uri")
|
||||
i.Author.Email = tn.S(ns, "email")
|
||||
}
|
||||
|
||||
ch.Items = append(ch.Items, i)
|
||||
}
|
||||
|
|
2
feed.go
2
feed.go
|
@ -165,7 +165,7 @@ func (this *Feed) makeFeed(doc *xmlx.Document) (err error) {
|
|||
this.CacheTimeout = this.Channels[0].TTL
|
||||
}
|
||||
|
||||
return
|
||||
return
|
||||
}
|
||||
|
||||
// This function returns true or false, depending on whether the CacheTimeout
|
||||
|
|
26
feed_test.go
26
feed_test.go
|
@ -1,8 +1,8 @@
|
|||
package feeder
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"io/ioutil"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var items []*Item
|
||||
|
@ -31,9 +31,9 @@ func TestFeed(t *testing.T) {
|
|||
|
||||
func Test_AtomAuthor(t *testing.T) {
|
||||
content, err := ioutil.ReadFile("testdata/idownload.atom")
|
||||
if err != nil {
|
||||
if err != nil {
|
||||
t.Errorf("unable to load file")
|
||||
}
|
||||
}
|
||||
feed := New(1, true, chanHandler, itemHandler)
|
||||
err = feed.FetchBytes("http://example.com", content, nil)
|
||||
|
||||
|
@ -45,15 +45,15 @@ func Test_AtomAuthor(t *testing.T) {
|
|||
}
|
||||
|
||||
func Test_RssAuthor(t *testing.T) {
|
||||
content, _ := ioutil.ReadFile("testdata/boing.rss")
|
||||
feed := New(1, true, chanHandler, itemHandler)
|
||||
feed.FetchBytes("http://example.com", content, nil)
|
||||
content, _ := ioutil.ReadFile("testdata/boing.rss")
|
||||
feed := New(1, true, chanHandler, itemHandler)
|
||||
feed.FetchBytes("http://example.com", content, nil)
|
||||
|
||||
item := items[0]
|
||||
expected := "Cory Doctorow"
|
||||
if item.Author.Name != expected {
|
||||
t.Errorf("Expected author to be %s but found %s", expected, item.Author.Name)
|
||||
}
|
||||
item := items[0]
|
||||
expected := "Cory Doctorow"
|
||||
if item.Author.Name != expected {
|
||||
t.Errorf("Expected author to be %s but found %s", expected, item.Author.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func Test_CData(t *testing.T) {
|
||||
|
@ -63,7 +63,7 @@ func Test_CData(t *testing.T) {
|
|||
|
||||
item := items[0]
|
||||
expected := `<p>abc<div>"def"</div>ghi`
|
||||
if item.Description != expected {
|
||||
if item.Description != expected {
|
||||
t.Errorf("Expected item.Description to be [%s] but item.Description=[%s]", expected, item.Description)
|
||||
}
|
||||
}
|
||||
|
@ -73,6 +73,6 @@ func chanHandler(feed *Feed, newchannels []*Channel) {
|
|||
}
|
||||
|
||||
func itemHandler(feed *Feed, ch *Channel, newitems []*Item) {
|
||||
items = newitems
|
||||
items = newitems
|
||||
println(len(newitems), "new item(s) in", ch.Title, "of", feed.Url)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue