This commit is contained in:
Walter Gray 2020-12-03 13:04:26 -08:00
parent e3210ff5eb
commit 34c1491418
2 changed files with 33 additions and 0 deletions

View File

@ -106,6 +106,10 @@ add_fmt_test(printf-test)
add_fmt_test(ranges-test) add_fmt_test(ranges-test)
add_fmt_test(scan-test) add_fmt_test(scan-test)
add_fmt_test(enforce-compiletime-test)
target_compile_definitions(enforce-compiletime-test PRIVATE "-DFMT_ENFORCE_COMPILE_STRING")
if (NOT DEFINED MSVC_STATIC_RUNTIME AND MSVC) if (NOT DEFINED MSVC_STATIC_RUNTIME AND MSVC)
foreach (flag_var foreach (flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE

View File

@ -0,0 +1,29 @@
// Formatting library for C++ - formatting library tests
//
// Copyright (c) 2012 - present, Victor Zverovich
// All rights reserved.
//
// For the license information refer to format.h.
#ifdef WIN32
# define _CRT_SECURE_NO_WARNINGS
#endif
#include "fmt/chrono.h"
#include "fmt/format.h"
#include "gmock.h"
#include "gtest-extra.h"
#ifndef FMT_STATIC_THOUSANDS_SEPARATOR
TEST(ChronoTest, FormatDefault) {
EXPECT_EQ("42s", fmt::format(FMT_STRING("{}"), std::chrono::seconds(42)));
}
TEST(ChronoTest, FormatWide) {
EXPECT_EQ(L"42s", fmt::format(FMT_STRING(L"{}"), std::chrono::seconds(42)));
}
#endif // FMT_STATIC_THOUSANDS_SEPARATOR