mirror of
https://github.com/fmtlib/fmt.git
synced 2025-11-02 15:11:43 +01:00
Range formatter (#2983)
* Implement range_formatter and format_kind * Attempted gcc 4.8 fix * gcc 4.8 interprets inaccessible as a hard error (instead of... not available) * Attempting to delete set_debug_format. * clang-format * Different implementation of FMT_STATICALLY_WIDEN * Renaming copy_str_range to copy_str. * I guess I need a definition * Forgot to delete these. * Other PR comments.
This commit is contained in:
@@ -40,6 +40,8 @@ TEST(ranges_test, format_2d_array) {
|
||||
TEST(ranges_test, format_array_of_literals) {
|
||||
const char* arr[] = {"1234", "abcd"};
|
||||
EXPECT_EQ(fmt::format("{}", arr), "[\"1234\", \"abcd\"]");
|
||||
EXPECT_EQ(fmt::format("{:n}", arr), "\"1234\", \"abcd\"");
|
||||
EXPECT_EQ(fmt::format("{:n:}", arr), "1234, abcd");
|
||||
}
|
||||
#endif // FMT_RANGES_TEST_ENABLE_C_STYLE_ARRAY
|
||||
|
||||
@@ -60,6 +62,7 @@ TEST(ranges_test, format_vector2) {
|
||||
TEST(ranges_test, format_map) {
|
||||
auto m = std::map<std::string, int>{{"one", 1}, {"two", 2}};
|
||||
EXPECT_EQ(fmt::format("{}", m), "{\"one\": 1, \"two\": 2}");
|
||||
EXPECT_EQ(fmt::format("{:n}", m), "\"one\": 1, \"two\": 2");
|
||||
}
|
||||
|
||||
TEST(ranges_test, format_set) {
|
||||
|
||||
Reference in New Issue
Block a user