mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-30 02:37:36 +02:00
Test FMT_BUILTIN_TYPES
This commit is contained in:
@ -62,13 +62,14 @@ if (NOT (MSVC AND BUILD_SHARED_LIBS))
|
|||||||
endif ()
|
endif ()
|
||||||
add_fmt_test(ostream-test)
|
add_fmt_test(ostream-test)
|
||||||
add_fmt_test(compile-test)
|
add_fmt_test(compile-test)
|
||||||
add_fmt_test(compile-fp-test HEADER_ONLY)
|
add_fmt_test(compile-fp-test)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
# Without this option, MSVC returns 199711L for the __cplusplus macro.
|
# Without this option, MSVC returns 199711L for the __cplusplus macro.
|
||||||
target_compile_options(compile-fp-test PRIVATE /Zc:__cplusplus)
|
target_compile_options(compile-fp-test PRIVATE /Zc:__cplusplus)
|
||||||
endif()
|
endif()
|
||||||
add_fmt_test(printf-test)
|
add_fmt_test(printf-test)
|
||||||
add_fmt_test(ranges-test ranges-odr-test.cc)
|
add_fmt_test(ranges-test ranges-odr-test.cc)
|
||||||
|
add_fmt_test(no-builtin-types-test HEADER_ONLY)
|
||||||
|
|
||||||
add_fmt_test(scan-test HEADER_ONLY)
|
add_fmt_test(scan-test HEADER_ONLY)
|
||||||
check_symbol_exists(strptime "time.h" HAVE_STRPTIME)
|
check_symbol_exists(strptime "time.h" HAVE_STRPTIME)
|
||||||
|
24
test/no-builtin-types-test.cc
Normal file
24
test/no-builtin-types-test.cc
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// Formatting library for C++ - formatting library tests
|
||||||
|
//
|
||||||
|
// Copyright (c) 2012 - present, Victor Zverovich
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// For the license information refer to format.h.
|
||||||
|
|
||||||
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
|
#if !defined(__GNUC__) || __GNUC__ >= 5
|
||||||
|
#define FMT_BUILTIN_TYPES 0
|
||||||
|
#include "fmt/format.h"
|
||||||
|
|
||||||
|
TEST(no_builtin_types_test, format) {
|
||||||
|
EXPECT_EQ(fmt::format("{}", 42), "42");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(no_builtin_types_test, double_is_custom_type) {
|
||||||
|
double d = 42;
|
||||||
|
auto args = fmt::make_format_args(d);
|
||||||
|
EXPECT_EQ(fmt::format_args(args).get(0).type(),
|
||||||
|
fmt::detail::type::custom_type);
|
||||||
|
}
|
||||||
|
#endif
|
Reference in New Issue
Block a user