diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index adb6fa6d1314..e1ea260d9adc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -62,13 +62,14 @@ if (NOT (MSVC AND BUILD_SHARED_LIBS)) endif () add_fmt_test(ostream-test) add_fmt_test(compile-test) -add_fmt_test(compile-fp-test HEADER_ONLY) +add_fmt_test(compile-fp-test) if (MSVC) # Without this option, MSVC returns 199711L for the __cplusplus macro. target_compile_options(compile-fp-test PRIVATE /Zc:__cplusplus) endif() add_fmt_test(printf-test) 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) check_symbol_exists(strptime "time.h" HAVE_STRPTIME) diff --git a/test/no-builtin-types-test.cc b/test/no-builtin-types-test.cc new file mode 100644 index 000000000000..fd15d0020fe6 --- /dev/null +++ b/test/no-builtin-types-test.cc @@ -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