Use textual representation for bool by default (#170)

This commit is contained in:
vitaut
2015-06-11 09:00:06 -07:00
parent fd5c2e909b
commit 9d09214e7a
5 changed files with 32 additions and 9 deletions
+6 -2
View File
@@ -1147,8 +1147,12 @@ void check_unknown_types(
}
}
TEST(FormatterTest, FormatBool) {
EXPECT_EQ(L"1", format(L"{}", true));
TEST(BoolTest, FormatBool) {
EXPECT_EQ("true", format("{}", true));
EXPECT_EQ("false", format("{}", false));
EXPECT_EQ("1", format("{:d}", true));
EXPECT_EQ("true ", format("{:5}", true));
EXPECT_EQ(L"true", format(L"{}", true));
}
TEST(FormatterTest, FormatShort) {
+4 -3
View File
@@ -413,9 +413,10 @@ ARG_INFO(INT, int, int_value);
ARG_INFO(UINT, unsigned, uint_value);
ARG_INFO(LONG_LONG, fmt::LongLong, long_long_value);
ARG_INFO(ULONG_LONG, fmt::ULongLong, ulong_long_value);
ARG_INFO(BOOL, int, int_value);
ARG_INFO(CHAR, int, int_value);
ARG_INFO(DOUBLE, double, double_value);
ARG_INFO(LONG_DOUBLE, long double, long_double_value);
ARG_INFO(CHAR, int, int_value);
ARG_INFO(CSTRING, const char *, string.value);
ARG_INFO(STRING, const char *, string.value);
ARG_INFO(WSTRING, const wchar_t *, wstring.value);
@@ -463,8 +464,8 @@ TEST(ArgTest, ArgInfo) {
TEST(ArgTest, MakeArg) {
// Test bool.
EXPECT_ARG_(char, INT, bool, int, true);
EXPECT_ARG_(wchar_t, INT, bool, int, true);
EXPECT_ARG_(char, BOOL, bool, int, true);
EXPECT_ARG_(wchar_t, BOOL, bool, int, true);
// Test char.
EXPECT_ARG(CHAR, signed char, 'a');