Enter Book::getLanguages()

This commit is contained in:
Veloman Yunkan
2023-03-01 16:38:13 +04:00
committed by Matthieu Gautier
parent 12826a57bd
commit b1ad319d52
4 changed files with 26 additions and 2 deletions

View File

@ -195,3 +195,22 @@ TEST(BookTest, getHumanReadableIdFromPath)
#endif
EXPECT_EQ("3plus2", path2HumanReadableId("3+2.zim"));
}
TEST(BookTest, getLanguages)
{
typedef std::vector<std::string> Langs;
{
const kiwix::Book book = makeBook(R"(id="abcd" language="fra")");
EXPECT_EQ(book.getLanguage(), "fra");
EXPECT_EQ(book.getLanguages(), Langs{ "fra" });
}
{
const kiwix::Book book = makeBook(R"(id="abcd" language="eng,ong,ing")");
EXPECT_EQ(book.getLanguage(), "eng,ong,ing");
EXPECT_EQ(book.getLanguages(), Langs({ "eng", "ong", "ing" }));
}
}