mirror of
https://github.com/XRPLF/rippled.git
synced 2026-06-04 17:27:00 +00:00
Improve test coverage
This commit is contained in:
@@ -160,6 +160,25 @@ protected:
|
||||
LogServiceState::replaceSinks({sink});
|
||||
}
|
||||
|
||||
/// Install a single sink with a custom formatter.
|
||||
static void
|
||||
installSinkWithFormatter(std::ostringstream& out, std::unique_ptr<spdlog::formatter> fmt)
|
||||
{
|
||||
auto sink = std::make_shared<spdlog::sinks::ostream_sink_mt>(out);
|
||||
sink->set_level(spdlog::level::trace);
|
||||
sink->set_formatter(std::move(fmt));
|
||||
LogServiceState::replaceSinks({sink});
|
||||
}
|
||||
|
||||
/// Clone a NonCriticalFormatter (friend access to makeNonCriticalFormatter).
|
||||
static std::unique_ptr<spdlog::formatter>
|
||||
cloneNonCriticalFormatter()
|
||||
{
|
||||
auto original = LogServiceState::makeNonCriticalFormatter(
|
||||
LogServiceState::makeFormatter(LogServiceState::format()));
|
||||
return original->clone();
|
||||
}
|
||||
|
||||
void
|
||||
TearDown() override
|
||||
{
|
||||
@@ -412,6 +431,13 @@ TEST_F(LoggerFixture, non_critical_formatter_all_non_critical_levels)
|
||||
<< "FTL should not appear in NonCriticalFormatter output: " << out;
|
||||
}
|
||||
|
||||
TEST_F(LoggerFixture, non_critical_formatter_clone_succeeds)
|
||||
{
|
||||
initLogging(false);
|
||||
auto cloned = cloneNonCriticalFormatter();
|
||||
EXPECT_NE(cloned, nullptr);
|
||||
}
|
||||
|
||||
TEST_F(LoggerFixture, console_enabled_creates_stdout_and_stderr_sinks)
|
||||
{
|
||||
// With enableConsole = true, init should create both a stdout sink
|
||||
|
||||
Reference in New Issue
Block a user