Add test
This commit is contained in:
parent
e3210ff5eb
commit
34c1491418
@ -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
|
||||||
|
|||||||
29
test/enforce-compiletime-test.cc
Normal file
29
test/enforce-compiletime-test.cc
Normal 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
|
||||||
Loading…
Reference in New Issue
Block a user