diff options
Diffstat (limited to 'reader/rss/parser_test.go')
-rw-r--r-- | reader/rss/parser_test.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/reader/rss/parser_test.go b/reader/rss/parser_test.go index dd1d261..b7ebd0a 100644 --- a/reader/rss/parser_test.go +++ b/reader/rss/parser_test.go @@ -837,6 +837,31 @@ func TestParseEntryWithCommentsURL(t *testing.T) { } } +func TestParseEntryWithInvalidCommentsURL(t *testing.T) { + data := `<?xml version="1.0" encoding="utf-8"?> + <rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"> + <channel> + <link>https://example.org/</link> + <item> + <title>Item 1</title> + <link>https://example.org/item1</link> + <comments> + Some text + </comments> + </item> + </channel> + </rss>` + + feed, err := Parse(bytes.NewBufferString(data)) + if err != nil { + t.Fatal(err) + } + + if feed.Entries[0].CommentsURL != "" { + t.Errorf("Incorrect entry comments URL, got: %q", feed.Entries[0].CommentsURL) + } +} + func TestParseInvalidXml(t *testing.T) { data := `garbage` _, err := Parse(bytes.NewBufferString(data)) |