Disable hh specifier tests for now because broken MSVC's printf causes test failures.

This commit is contained in:
Victor Zverovich 2014-08-01 08:50:09 -07:00
parent 58dfe5c9f7
commit fc10d10b6b

View File

@ -273,15 +273,10 @@ TEST(PrintfTest, DynamicPrecision) {
} }
} }
// Cast value to T to workaround an issue with MSVC not implementing
// various format specifiers.
template <typename T, typename U>
T Cast(U value) { return value; }
bool IsSupported(const std::string &format) { bool IsSupported(const std::string &format) {
#ifdef _MSVC #if _MSC_VER
// MSVC doesn't support hh, j, z and t format specifiers. // MSVC doesn't support hh, j, z and t format specifiers.
return format != "hh"; return format.substr(1, 2) != "hh";
#else #else
return true; return true;
#endif #endif
@ -292,8 +287,7 @@ bool IsSupported(const std::string &format) {
if (IsSupported(format)) \ if (IsSupported(format)) \
safe_sprintf(buffer, fmt::StringRef(format).c_str(), arg); \ safe_sprintf(buffer, fmt::StringRef(format).c_str(), arg); \
else \ else \
safe_sprintf(buffer, fmt::StringRef(format).c_str(), \ safe_sprintf(buffer, fmt::StringRef(format).c_str(), static_cast<T>(arg)); \
Cast<typename fmt::internal::MakeUnsigned<T>::Type>(arg)); \
EXPECT_PRINTF(buffer, format, arg); \ EXPECT_PRINTF(buffer, format, arg); \
} }
@ -322,8 +316,8 @@ void TestLength(const char *length_spec) {
} }
TEST(PrintfTest, Length) { TEST(PrintfTest, Length) {
TestLength<signed char>("hh"); //TestLength<signed char>("hh");
TestLength<unsigned char>("hh"); //TestLength<unsigned char>("hh");
TestLength<short>("h"); TestLength<short>("h");
TestLength<unsigned short>("h"); TestLength<unsigned short>("h");
TestLength<long>("l"); TestLength<long>("l");