diff --git a/feed_test.go b/feed_test.go index c162cd9..4e28eb2 100644 --- a/feed_test.go +++ b/feed_test.go @@ -56,6 +56,18 @@ func Test_RssAuthor(t *testing.T) { } } +func Test_CData(t *testing.T) { + content, _ := ioutil.ReadFile("testdata/iosBoardGameGeek.rss") + feed := New(1, true, chanHandler, itemHandler) + feed.FetchBytes("http://example.com", content, nil) + + item := items[0] + expected := `

abc

"def"
ghi` + if item.Description != expected { + t.Errorf("Expected item.Description to be [%s] but item.Description=[%s]", expected, item.Description) + } +} + func chanHandler(feed *Feed, newchannels []*Channel) { println(len(newchannels), "new channel(s) in", feed.Url) } diff --git a/testdata/iosBoardGameGeek.rss b/testdata/iosBoardGameGeek.rss new file mode 100644 index 0000000..14afc1b --- /dev/null +++ b/testdata/iosBoardGameGeek.rss @@ -0,0 +1,28 @@ + + + + iOS Board Games | BoardGameGeek + + http://geekdo-images.com/images/geeksm.gif + http://boardgamegeek.com/ + iOS Board Games | BoardGameGeek + + BoardGameGeek features information related to the board gaming hobby + en-us + Thu, 28 Mar 2013 14:51:20 +0000 + Thu, 28 Mar 2013 14:51:20 +0000 + http://boardgamegeek.com/ + webmaster@boardgamegeek.com + + + iOS News: Stone Age 2.0 Released, Ravensburger March Sale Features San Juan, More Info on Las Vegas, Shifts Gets an Update and more... +<p>abc"def"]]>ghi + +http://boardgamegeek.com/blogpost/18194/ios-news-stone-age-2-0-released-ravensburger-march +http://boardgamegeek.com/blogpost/18194/ios-news-stone-age-2-0-released-ravensburger-march +Thu, 28 Mar 2013 14:51:20 +0000 +Neumannium + + + \ No newline at end of file