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>
55 lines
1.5 KiB
C++
55 lines
1.5 KiB
C++
#include <Void/Functional/Detail/Repr.hpp>
|
|
#include <Void/Testing/Assert.hpp>
|
|
#include <Void/Testing/Test.hpp>
|
|
|
|
#include <string>
|
|
|
|
namespace
|
|
{
|
|
struct PlainStruct {
|
|
int code;
|
|
std::string label;
|
|
};
|
|
|
|
struct DiagInfo {
|
|
std::string file;
|
|
int line;
|
|
std::string detail;
|
|
};
|
|
} // namespace
|
|
|
|
Void::Testing::Test repr_uses_std_format_when_available()
|
|
{
|
|
const auto out = Void::Result::Detail::repr(42);
|
|
Void::Testing::expect_eq(out, std::string{"42"});
|
|
}
|
|
|
|
Void::Testing::Test repr_uses_std_format_for_string()
|
|
{
|
|
const auto out = Void::Result::Detail::repr(std::string{"hello"});
|
|
Void::Testing::expect_eq(out, std::string{"hello"});
|
|
}
|
|
|
|
#ifdef VOID_RESULT_HAS_REFLECTION
|
|
// @tag reflection
|
|
Void::Testing::Test repr_walks_struct_fields_via_reflection()
|
|
{
|
|
PlainStruct s{42, "ok"};
|
|
const auto out = Void::Result::Detail::repr(s);
|
|
Void::Testing::expect(out.find("PlainStruct") != std::string::npos);
|
|
Void::Testing::expect(out.find("code: 42") != std::string::npos);
|
|
Void::Testing::expect(out.find("label: ok") != std::string::npos);
|
|
}
|
|
|
|
// @tag reflection
|
|
Void::Testing::Test repr_handles_multiple_fields()
|
|
{
|
|
DiagInfo d{"foo.cpp", 17, "bad token"};
|
|
const auto out = Void::Result::Detail::repr(d);
|
|
Void::Testing::expect(out.find("DiagInfo") != std::string::npos);
|
|
Void::Testing::expect(out.find("file: foo.cpp") != std::string::npos);
|
|
Void::Testing::expect(out.find("line: 17") != std::string::npos);
|
|
Void::Testing::expect(out.find("detail: bad token") != std::string::npos);
|
|
}
|
|
#endif
|