Deduplicated test output data

This commit is contained in:
Veloman Yunkan 2024-03-05 18:18:54 +04:00 committed by Matthieu Gautier
parent 2749564424
commit 5e669cd65c
1 changed files with 8 additions and 12 deletions

View File

@ -55,6 +55,12 @@ public:
operator std::string() const { return buffer.str(); } operator std::string() const { return buffer.str(); }
}; };
const std::string ZERO_FOUR_NAME_CONFLICT_MSG =
"Path collision: /data/zero_four_2021-10.zim and"
" /data/zero_four_2021-11.zim can't share the same URL path 'zero_four'."
" Therefore, only /data/zero_four_2021-10.zim will be served.\n";
} // unnamed namespace } // unnamed namespace
void checkUnaliasedEntriesInNameMapper(const kiwix::NameMapper& nm) void checkUnaliasedEntriesInNameMapper(const kiwix::NameMapper& nm)
@ -91,12 +97,7 @@ TEST_F(NameMapperTest, HumanReadableNameMapperWithAliases)
{ {
CapturedStderr stderror; CapturedStderr stderror;
kiwix::HumanReadableNameMapper nm(*lib, true); kiwix::HumanReadableNameMapper nm(*lib, true);
EXPECT_EQ( EXPECT_EQ(ZERO_FOUR_NAME_CONFLICT_MSG, std::string(stderror));
"Path collision: /data/zero_four_2021-10.zim and"
" /data/zero_four_2021-11.zim can't share the same URL path 'zero_four'."
" Therefore, only /data/zero_four_2021-10.zim will be served.\n"
, std::string(stderror)
);
checkUnaliasedEntriesInNameMapper(nm); checkUnaliasedEntriesInNameMapper(nm);
EXPECT_EQ("04-2021-10", nm.getIdForName("zero_four")); EXPECT_EQ("04-2021-10", nm.getIdForName("zero_four"));
@ -127,12 +128,7 @@ TEST_F(NameMapperTest, UpdatableNameMapperWithAliases)
{ {
CapturedStderr stderror; CapturedStderr stderror;
kiwix::UpdatableNameMapper nm(lib, true); kiwix::UpdatableNameMapper nm(lib, true);
EXPECT_EQ( EXPECT_EQ(ZERO_FOUR_NAME_CONFLICT_MSG, std::string(stderror));
"Path collision: /data/zero_four_2021-10.zim and"
" /data/zero_four_2021-11.zim can't share the same URL path 'zero_four'."
" Therefore, only /data/zero_four_2021-10.zim will be served.\n"
, std::string(stderror)
);
checkUnaliasedEntriesInNameMapper(nm); checkUnaliasedEntriesInNameMapper(nm);
EXPECT_EQ("04-2021-10", nm.getIdForName("zero_four")); EXPECT_EQ("04-2021-10", nm.getIdForName("zero_four"));