From d6cec3edef04df753ffabdd1a40c171583c8ecd3 Mon Sep 17 00:00:00 2001 From: VirtualTam Date: Thu, 7 Nov 2024 22:28:42 +0100 Subject: [PATCH] opml: add feedly test case Signed-off-by: VirtualTam --- marshal_feedreader_test.go | 64 +++++++++++++++++++++++++++++++++ opml_document.go | 1 + testdata/feedreader/feedly.opml | 18 ++++++++++ 3 files changed, 83 insertions(+) create mode 100644 testdata/feedreader/feedly.opml diff --git a/marshal_feedreader_test.go b/marshal_feedreader_test.go index d48181f..f1d73fd 100644 --- a/marshal_feedreader_test.go +++ b/marshal_feedreader_test.go @@ -10,6 +10,65 @@ import ( ) var ( + feedReaderDocumentFeedly = Document{ + XMLName: xml.Name{Local: "opml"}, + Version: Version1, + Head: Head{ + Title: "My subscriptions in feedly Cloud", + }, + Body: Body{ + Outlines: []Outline{ + { + Text: "Programming", + Title: "Programming", + Outlines: []Outline{ + { + Text: "Elixir Lang", + Title: "Elixir Lang", + Type: OutlineTypeSubscription, + HtmlUrl: "http://elixir-lang.org", + XmlUrl: "https://feeds.feedburner.com/ElixirLang", + }, + { + Text: "Zephyr Project", + Title: "Zephyr Project", + Type: OutlineTypeSubscription, + HtmlUrl: "https://www.zephyrproject.org", + XmlUrl: "https://www.zephyrproject.org/feed/", + }, + { + Text: "Python Insider", + Title: "Python Insider", + Type: OutlineTypeSubscription, + HtmlUrl: "https://pythoninsider.blogspot.com/", + XmlUrl: "https://feeds.feedburner.com/PythonInsider", + }, + }, + }, + { + Text: "Games", + Title: "Games", + Outlines: []Outline{ + { + Text: "BeamNG.drive", + Title: "BeamNG.drive", + Type: OutlineTypeSubscription, + HtmlUrl: "https://www.beamng.com/game/", + XmlUrl: "https://www.beamng.com/game/index.xml", + }, + { + Text: "Vintage Story", + Title: "Vintage Story", + Type: OutlineTypeSubscription, + HtmlUrl: "https://www.vintagestory.at/blog.html/", + XmlUrl: "https://www.vintagestory.at/blog.html/?rss=1", + }, + }, + }, + }, + }, + } + feedReaderDocumentNewsblur = Document{ XMLName: xml.Name{Local: "opml"}, Version: Version1_1, @@ -91,6 +150,11 @@ func TestUnmarshalFeedReader(t *testing.T) { inputFileName string want Document }{ + { + tname: "feedly", + inputFileName: "feedly.opml", + want: feedReaderDocumentFeedly, + }, { tname: "newsblur", inputFileName: "newsblur.opml", diff --git a/opml_document.go b/opml_document.go index 3833bae..8982891 100644 --- a/opml_document.go +++ b/opml_document.go @@ -17,6 +17,7 @@ type ( ) const ( + Version1 string = "1.0" Version1_1 string = "1.1" Version2 string = "2.0" diff --git a/testdata/feedreader/feedly.opml b/testdata/feedreader/feedly.opml new file mode 100644 index 0000000..7908170 --- /dev/null +++ b/testdata/feedreader/feedly.opml @@ -0,0 +1,18 @@ + + + + + My subscriptions in feedly Cloud + + + + + + + + + + + + +