summaryrefslogtreecommitdiff
path: root/asl/tests/status_tests.cpp
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2025-01-23 23:59:32 +0100
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2025-01-23 23:59:32 +0100
commitdeecf07bd1feadf76aadba127c7b64f931800c20 (patch)
treec10e39156b70ffe4f92c5ad8e6f722c1065d04d8 /asl/tests/status_tests.cpp
parent5c45530359187a63356dae05314263168e6a31a1 (diff)
Add StringWriter, and use it instead of StringSink
Diffstat (limited to 'asl/tests/status_tests.cpp')
-rw-r--r--asl/tests/status_tests.cpp20
1 files changed, 7 insertions, 13 deletions
diff --git a/asl/tests/status_tests.cpp b/asl/tests/status_tests.cpp
index b598389..d8aa923 100644
--- a/asl/tests/status_tests.cpp
+++ b/asl/tests/status_tests.cpp
@@ -1,7 +1,7 @@
#include "asl/status.hpp"
#include "asl/testing/testing.hpp"
#include "asl/format.hpp"
-#include "asl/tests/test_types.hpp"
+#include "asl/string_builder.hpp"
ASL_TEST(simple_ok)
{
@@ -68,21 +68,15 @@ static_assert(asl::formattable<asl::status>);
ASL_TEST(format)
{
- StringSink sink;
+ auto s = asl::format_to_string("-{}-", asl::ok());
+ ASL_TEST_EXPECT(s == "-[ok]-"_sv);
- asl::format(&sink, "-{}-", asl::ok());
- ASL_TEST_EXPECT(sink.str() == "-[ok]-"_sv);
-
- sink.reset();
- asl::format(&sink, "-{}-", asl::internal_error("hello"));
- ASL_TEST_EXPECT(sink.str() == "-[internal: hello]-"_sv);
+ s = asl::format_to_string("-{}-", asl::internal_error("hello"));
+ ASL_TEST_EXPECT(s == "-[internal: hello]-"_sv);
}
ASL_TEST(make_with_format)
{
- StringSink sink;
-
- sink.reset();
- asl::format(&sink, "-{}-", asl::internal_error("hello, {}, {}", 45, "world"));
- ASL_TEST_EXPECT(sink.str() == "-[internal: hello, 45, world]-"_sv);
+ auto s = asl::format_to_string("-{}-", asl::internal_error("hello, {}, {}", 45, "world"));
+ ASL_TEST_EXPECT(s == "-[internal: hello, 45, world]-"_sv);
}