Improve width computation

This commit is contained in:
Victor Zverovich
2020-03-04 16:43:49 -08:00
parent 0c6919ec72
commit eafd079868
2 changed files with 49 additions and 4 deletions

View File

@@ -6,6 +6,7 @@
// For the license information refer to format.h.
#include <stdint.h>
#include <cctype>
#include <cfloat>
#include <climits>
@@ -987,7 +988,9 @@ TEST(FormatterTest, Width) {
EXPECT_EQ(" 0xcafe", format("{0:10}", reinterpret_cast<void*>(0xcafe)));
EXPECT_EQ("x ", format("{0:11}", 'x'));
EXPECT_EQ("str ", format("{0:12}", "str"));
EXPECT_EQ(fmt::format("{:*^5}", "🤡"), "**🤡**");
}
template <typename T> inline T const_check(T value) { return value; }
TEST(FormatterTest, RuntimeWidth) {