From cc805c6162c8b6bfcde2f25e15dc745afe628859 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Thu, 8 Nov 2018 10:59:10 -0800 Subject: [PATCH] Test enabled formatters --- test/format-test.cc | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/test/format-test.cc b/test/format-test.cc index 927eb2a8..b8663147 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -45,6 +45,22 @@ using testing::StrictMock; namespace { +template +bool check_enabled_formatter() { + static_assert(std::is_default_constructible>::value, ""); + return true; +} + +template +void check_enabled_formatters() { + auto dummy = {check_enabled_formatter()...}; + (void)dummy; +} + +TEST(FormatterTest, TestFormattersEnabled) { + check_enabled_formatters(); +} + // Format value using the standard library. template void std_format(const T &value, std::basic_string &result) { @@ -768,7 +784,7 @@ TEST(FormatterTest, ArgErrors) { template struct TestFormat { template - static std::string format(fmt::string_view format_str, const Args & ... args) { + static std::string format(fmt::string_view format_str, const Args &... args) { return TestFormat::format(format_str, N - 1, args...); } }; @@ -776,7 +792,7 @@ struct TestFormat { template <> struct TestFormat<0> { template - static std::string format(fmt::string_view format_str, const Args & ... args) { + static std::string format(fmt::string_view format_str, const Args &... args) { return fmt::format(format_str, args...); } };