summaryrefslogtreecommitdiff
path: root/test/rsspp_parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/rsspp_parser.cpp')
-rw-r--r--test/rsspp_parser.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/rsspp_parser.cpp b/test/rsspp_parser.cpp
index 04978612..e99283ac 100644
--- a/test/rsspp_parser.cpp
+++ b/test/rsspp_parser.cpp
@@ -49,6 +49,48 @@ TEST_CASE("Extracts data from RSS 0.91", "[rsspp::Parser]")
REQUIRE(f.items[0].guid == "");
}
+TEST_CASE("Doesn't crash or garble data if an item in RSS 0.9x contains "
+ "an empty author tag",
+ "[rsspp::Parser][issue542]")
+{
+ rsspp::Parser p;
+ rsspp::Feed f;
+
+ SECTION("RSS 0.91") {
+ REQUIRE_NOTHROW(f = p.parse_file("data/rss_091_with_empty_author.xml"));
+ REQUIRE(f.rss_version == rsspp::Feed::RSS_0_91);
+ }
+
+ SECTION("RSS 0.92") {
+ REQUIRE_NOTHROW(f = p.parse_file("data/rss_092_with_empty_author.xml"));
+ REQUIRE(f.rss_version == rsspp::Feed::RSS_0_92);
+ }
+
+ SECTION("RSS 0.94") {
+ REQUIRE_NOTHROW(f = p.parse_file("data/rss_094_with_empty_author.xml"));
+ REQUIRE(f.rss_version == rsspp::Feed::RSS_0_94);
+ }
+
+ REQUIRE(f.title == "A Channel with Unnamed Authors");
+ REQUIRE(f.description == "an example feed");
+ REQUIRE(f.link == "http://example.com/");
+ REQUIRE(f.language == "en");
+
+ REQUIRE(f.items.size() == 2u);
+
+ REQUIRE(f.items[0].title == "This one has en empty author tag");
+ REQUIRE(f.items[0].link == "http://example.com/test_1.html");
+ REQUIRE(f.items[0].description == "It doesn't matter.");
+ REQUIRE(f.items[0].author == "");
+ REQUIRE(f.items[0].guid == "");
+
+ REQUIRE(f.items[1].title == "This one has en empty author tag as well");
+ REQUIRE(f.items[1].link == "http://example.com/test_2.html");
+ REQUIRE(f.items[1].description == "Non-empty description though.");
+ REQUIRE(f.items[1].author == "");
+ REQUIRE(f.items[1].guid == "");
+}
+
TEST_CASE("Extracts data from RSS 0.92", "[rsspp::Parser]")
{
rsspp::Parser p;