Skip to content

Commit

Permalink
opml: add feedly test case
Browse files Browse the repository at this point in the history
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
  • Loading branch information
virtualtam committed Nov 7, 2024
1 parent 817e827 commit d6cec3e
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
64 changes: 64 additions & 0 deletions marshal_feedreader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions opml_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ type (
)

const (
Version1 string = "1.0"
Version1_1 string = "1.1"
Version2 string = "2.0"

Expand Down
18 changes: 18 additions & 0 deletions testdata/feedreader/feedly.opml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>

<opml version="1.0">
<head>
<title>My subscriptions in feedly Cloud</title>
</head>
<body>
<outline text="Programming" title="Programming">
<outline type="rss" text="Elixir Lang" title="Elixir Lang" xmlUrl="https://feeds.feedburner.com/ElixirLang" htmlUrl="http://elixir-lang.org"/>
<outline type="rss" text="Zephyr Project" title="Zephyr Project" xmlUrl="https://www.zephyrproject.org/feed/" htmlUrl="https://www.zephyrproject.org"/>
<outline type="rss" text="Python Insider" title="Python Insider" xmlUrl="https://feeds.feedburner.com/PythonInsider" htmlUrl="https://pythoninsider.blogspot.com/"/>
</outline>
<outline text="Games" title="Games">
<outline type="rss" text="BeamNG.drive" title="BeamNG.drive" xmlUrl="https://www.beamng.com/game/index.xml" htmlUrl="https://www.beamng.com/game/"/>
<outline type="rss" text="Vintage Story" title="Vintage Story" xmlUrl="https://www.vintagestory.at/blog.html/?rss=1" htmlUrl="https://www.vintagestory.at/blog.html/"/>
</outline>
</body>
</opml>

0 comments on commit d6cec3e

Please sign in to comment.