//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME // // template... Ts> // struct formatter, charT> // constexpr void constexpr void set_brackets(basic_string_view opening, // basic_string_view closing) noexcept; // Note this tests the basics of this function. It's tested in more detail in // the format functions tests. #include #include #include #include "make_string.h" #define SV(S) MAKE_STRING_VIEW(CharT, S) template constexpr void test() { std::formatter formatter; formatter.set_brackets(SV("open"), SV("close")); // Note the SV macro may throw, so can't use it. static_assert(noexcept(formatter.set_brackets(std::basic_string_view{}, std::basic_string_view{}))); // Note there is no direct way to validate this function modified the object. } template constexpr void test() { test>(); test>(); test>(); test>(); } constexpr bool test() { test(); #ifndef TEST_HAS_NO_WIDE_CHARACTERS test(); #endif return true; } int main(int, char**) { test(); static_assert(test()); return 0; }