🛠 Cage changed return types with #if FMT_OUTPUT_RANGES

This commit is contained in:
ThePhD 2023-12-14 23:50:08 -05:00
parent 864d612554
commit 012b98ed99
No known key found for this signature in database
GPG Key ID: 1509DB1C0F702BFA
2 changed files with 10 additions and 0 deletions

View File

@ -1696,8 +1696,13 @@ TEST(format_test, format_custom) {
TEST(format_test, format_to_custom) { TEST(format_test, format_to_custom) {
char buf[10] = {}; char buf[10] = {};
#if FMT_OUTPUT_RANGES
auto result_range = fmt::format_to(buf, "{}", Answer()); auto result_range = fmt::format_to(buf, "{}", Answer());
EXPECT_EQ(result_range.begin(), buf + 2); EXPECT_EQ(result_range.begin(), buf + 2);
#else
auto end = fmt::format_to(buf, "{}", Answer());
EXPECT_EQ(end, buf + 2);
#endif
EXPECT_STREQ(buf, "42"); EXPECT_STREQ(buf, "42");
} }

View File

@ -205,8 +205,13 @@ TEST(ranges_test, format_struct) {
TEST(ranges_test, format_to) { TEST(ranges_test, format_to) {
char buf[10]; char buf[10];
#if FMT_OUTPUT_RANGES
auto result_range = fmt::format_to(buf, "{}", std::vector<int>{1, 2, 3}); auto result_range = fmt::format_to(buf, "{}", std::vector<int>{1, 2, 3});
*result_range.begin() = '\0'; *result_range.begin() = '\0';
#else
auto end = fmt::format_to(buf, "{}", std::vector<int>{1, 2, 3});
*end = '\0';
#endif
EXPECT_STREQ(buf, "[1, 2, 3]"); EXPECT_STREQ(buf, "[1, 2, 3]");
} }