Headers move, CMake targets merge, C++ namespaces stay unchanged: - Core: Scope, Lazy, Counted, Flags, Hash, Bits, Uuid, TypeList, TypeMap, Variant - Functional: Pipeline, Either, Result, Retry - Containers: Ring, Pool, PriorityQueue, LRU, Trie, Graph, DisjointSet, Bitset, Interval - Math: +Matrix, Numeric, Random, Histogram - Text: Str, Format, Tokenizer, Diff, Encoding, Semver - Data: Json, Csv, Ini - Async: Coro, Concurrency, EventBus, Observable - Time: +Bench - Log: Log facade + Logging framework (facade now header-only, breaking the Stacktrace<->Log link cycle the merge would have created) - System: FileSystem + Process - Configuration: +Argparse - Unchanged: Stacktrace, Plugin, StateMachine, Testing, TestingMock, Detail Module system fixes: - OPTIONAL_DEPS resolution deferred to void_finalize_modules() so it no longer depends on the alphabetical discovery order of src/ subdirs (Testing -> Text would have been silently dropped). - Every header-only module now has a tracked module.cmake; previously the empty src/<Name> marker dirs were untracked, so a fresh clone would have silently skipped those modules. - VOID_HAS_LOGGING/CONCURRENCY/STR consumers renamed to LOG/ASYNC/TEXT. Tests move to tests/standalone/<Umbrella>/<Feature>.cpp (Result suite files prefixed: ResultBasic etc.). Test count verified identical (831) before and after. README/CLAUDE.md module tables updated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
63 lines
1.7 KiB
C++
63 lines
1.7 KiB
C++
#include <Void/Log/ConsoleLogger.hpp>
|
|
#include <Void/Log/Level.hpp>
|
|
#include <Void/Testing/Assert.hpp>
|
|
#include <Void/Testing/Fixture.hpp>
|
|
#include <Void/Testing/Test.hpp>
|
|
|
|
#include <sstream>
|
|
#include <string>
|
|
|
|
class ConsoleLoggerTests : public Void::Testing::Fixture
|
|
{
|
|
public:
|
|
|
|
Void::Testing::Test writes_to_stream()
|
|
{
|
|
std::ostringstream out;
|
|
{
|
|
Void::Logging::ConsoleLogger log(out);
|
|
log.info("hello world");
|
|
}
|
|
const auto content = out.str();
|
|
Void::Testing::expect(content.find("hello world") !=
|
|
std::string::npos);
|
|
Void::Testing::expect(content.find("Info") != std::string::npos);
|
|
}
|
|
|
|
Void::Testing::Test level_filtering()
|
|
{
|
|
std::ostringstream out;
|
|
{
|
|
Void::Logging::ConsoleLogger log(out);
|
|
log.set_level(Void::Logging::Level::Error);
|
|
log.info("filtered out");
|
|
log.error("kept");
|
|
}
|
|
const auto content = out.str();
|
|
Void::Testing::expect(content.find("filtered out") ==
|
|
std::string::npos);
|
|
Void::Testing::expect(content.find("kept") != std::string::npos);
|
|
}
|
|
|
|
Void::Testing::Test multiple_levels_emit_in_order()
|
|
{
|
|
std::ostringstream out;
|
|
{
|
|
Void::Logging::ConsoleLogger log(out);
|
|
log.set_level(Void::Logging::Level::Trace);
|
|
log.trace("first");
|
|
log.warning("second");
|
|
log.fatal("third");
|
|
}
|
|
const auto content = out.str();
|
|
const auto first = content.find("first");
|
|
const auto second = content.find("second");
|
|
const auto third = content.find("third");
|
|
Void::Testing::expect(first != std::string::npos);
|
|
Void::Testing::expect(second != std::string::npos);
|
|
Void::Testing::expect(third != std::string::npos);
|
|
Void::Testing::expect(first < second);
|
|
Void::Testing::expect(second < third);
|
|
}
|
|
};
|