From 249cecdb50294b15f27e07bff809cc452c93e021 Mon Sep 17 00:00:00 2001 From: light7734 Date: Thu, 18 Sep 2025 19:32:11 +0330 Subject: [PATCH] refactor(tests): printable now checks if the type is std::formattable --- modules/test/public/expects.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/test/public/expects.hpp b/modules/test/public/expects.hpp index 8878092..35acc6a 100644 --- a/modules/test/public/expects.hpp +++ b/modules/test/public/expects.hpp @@ -7,9 +7,12 @@ namespace lt::test { template -concept Printable = requires(std::ostream &stream, T value) { - { stream << value } -> std::same_as; -} || requires(std::ostream &stream, T value) { +concept Formattable = requires(T &v, std::format_context ctx) { + std::formatter>().format(v, ctx); +}; + +template +concept Printable = Formattable || requires(std::ostream &stream, T value) { { stream << std::to_underlying(value) } -> std::same_as; };