mirror of
https://github.com/kiwix/libkiwix.git
synced 2026-03-09 09:40:21 -04:00
Extracted test/testing_tools.h
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
#include "../include/library.h"
|
||||
#include "../include/manager.h"
|
||||
#include "testing_tools.h"
|
||||
using namespace kiwix::testing;
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
namespace
|
||||
@@ -58,27 +61,6 @@ class NameMapperTest : public ::testing::Test {
|
||||
std::shared_ptr<kiwix::Library> lib;
|
||||
};
|
||||
|
||||
class CapturedStderr
|
||||
{
|
||||
std::ostringstream buffer;
|
||||
std::streambuf* const sbuf;
|
||||
public:
|
||||
CapturedStderr()
|
||||
: sbuf(std::cerr.rdbuf())
|
||||
{
|
||||
std::cerr.rdbuf(buffer.rdbuf());
|
||||
}
|
||||
|
||||
CapturedStderr(const CapturedStderr&) = delete;
|
||||
|
||||
~CapturedStderr()
|
||||
{
|
||||
std::cerr.rdbuf(sbuf);
|
||||
}
|
||||
|
||||
operator std::string() const { return buffer.str(); }
|
||||
};
|
||||
|
||||
#if _WIN32
|
||||
const std::string ZERO_FOUR_NAME_CONFLICT_MSG =
|
||||
"Path collision: 'C:\\data\\zero_four_2021-10.zim' and"
|
||||
|
||||
Reference in New Issue
Block a user