RSS implemented and tested

This commit is contained in:
Bel LaPointe
2018-10-08 10:02:34 -06:00
parent 24e30a7eee
commit 49d95c150e
5 changed files with 212 additions and 48 deletions

View File

@@ -12,6 +12,32 @@ func Test_RSSItem(t *testing.T) {
filter string
output Item
}{
{
input: gofeed.Item{
Title: "a",
Link: "b",
Content: `<img src="A" and=things/> <img src="asdf" and="some-toher-stuff"></img>`,
},
filter: `<[a-z]+.+?/([a-z]+)?>`,
output: Item{
Name: "a",
Link: "b",
Content: `<img src="A"/><br><img src="asdf"/>`,
},
},
{
input: gofeed.Item{
Title: "a",
Link: "b",
Content: `a b c <img src="asdf" and="some-toher-stuff"></img> d e f`,
},
filter: `<[a-z]+.+?/([a-z]+)?>`,
output: Item{
Name: "a",
Link: "b",
Content: `<img src="asdf"/>`,
},
},
{
input: gofeed.Item{
Title: "a",
@@ -29,13 +55,13 @@ func Test_RSSItem(t *testing.T) {
input: gofeed.Item{
Title: "a",
Link: "b",
Content: `x y <img src="asdf"></img>`,
Content: `<img src="asdf"></img>`,
},
filter: "[a-z]*",
filter: "",
output: Item{
Name: "a",
Link: "b",
Content: "x\n<br>\ny",
Content: `<img src="asdf"/>`,
},
},
{
@@ -48,7 +74,7 @@ func Test_RSSItem(t *testing.T) {
output: Item{
Name: "a",
Link: "b",
Content: "x\n<br>\ny",
Content: "x<br>y",
},
},
}