diff --git a/src/parser/atom_test.go b/src/parser/atom_test.go
index 2ef8174..0ce4783 100644
--- a/src/parser/atom_test.go
+++ b/src/parser/atom_test.go
@@ -102,6 +102,7 @@ func TestAtomXHTMLTitle(t *testing.T) {
have := feed.Items[0].Title
want := "say what?"
if !reflect.DeepEqual(want, have) {
+ t.Log(feed)
t.Logf("want: %#v", want)
t.Logf("have: %#v", have)
t.FailNow()
diff --git a/src/parser/rss_test.go b/src/parser/rss_test.go
index df7b981..097afd2 100644
--- a/src/parser/rss_test.go
+++ b/src/parser/rss_test.go
@@ -327,3 +327,68 @@ func TestRSSMultipleMedia(t *testing.T) {
t.Fatal("invalid rss")
}
}
+
+// When both RSS and Atom elements are present in an item,
+// the RSS link must not be lost. The tag is namespace-qualified as
+// `rss link` to disambiguate — see commit ee2a825, found in:
+// https://rss.nytimes.com/services/xml/rss/nyt/Arts.xml
+func TestRSSItemLinkWithAtomLinkPresent(t *testing.T) {
+ have, _ := Parse(strings.NewReader(`
+
+
+
+ Example
+ -
+ Article
+ http://example.com/article/1
+
+
+
+
+ `))
+ want := &Feed{
+ Title: "Example",
+ Items: []Item{
+ {
+ GUID: "http://example.com/article/1",
+ URL: "http://example.com/article/1",
+ Title: "Article",
+ },
+ },
+ }
+ if !reflect.DeepEqual(want, have) {
+ t.Fatalf("RSS link lost when atom:link is present\nwant: %#v\nhave: %#v", want, have)
+ }
+}
+
+// Feeds that declare a default namespace on the root element (e.g. the
+// legacy Userland namespace) must still parse — see sud.ua/rss/rss_news_uk.xml.
+func TestRSSDefaultNamespace(t *testing.T) {
+ have, _ := Parse(strings.NewReader(`
+
+
+
+ Feed
+ -
+ Title 1
+ https://example.com/news/1
+
+
+
+ `))
+ want := &Feed{
+ Title: "Feed",
+ Items: []Item{
+ {
+ GUID: "https://example.com/news/1",
+ URL: "https://example.com/news/1",
+ Title: "Title 1",
+ },
+ },
+ }
+ if !reflect.DeepEqual(want, have) {
+ t.Fatalf("default-namespaced rss not parsed \nwant: %#v\nhave: %#v", want, have)
+ // t.Logf("have: %#v", have)
+ // t.Fatal("default-namespaced rss not parsed")
+ }
+}