1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
11 // UNSUPPORTED: GCC-ALWAYS_INLINE-FIXME
15 // class range_formatter
16 // template<class charT, formattable<charT>... Ts>
17 // struct formatter<pair-or-tuple<Ts...>, charT>
19 // constexpr void set_separator(basic_string_view<charT> sep) noexcept;
21 // Note this tests the basics of this function. It's tested in more detail in
22 // the format functions tests.
28 #include "make_string.h"
30 #define SV(S) MAKE_STRING_VIEW(CharT, S)
32 template <class CharT
, class Arg
>
33 constexpr void test() {
34 std::formatter
<Arg
, CharT
> formatter
;
35 formatter
.set_separator(SV("sep"));
36 // Note the SV macro may throw, so can't use it.
37 static_assert(noexcept(formatter
.set_separator(std::basic_string_view
<CharT
>{})));
39 // Note there is no direct way to validate this function modified the object.
42 template <class CharT
>
43 constexpr void test() {
44 test
<CharT
, std::tuple
<int>>();
45 test
<CharT
, std::tuple
<int, CharT
>>();
46 test
<CharT
, std::pair
<int, CharT
>>();
47 test
<CharT
, std::tuple
<int, CharT
, bool>>();
50 constexpr bool test() {
52 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
59 int main(int, char**) {
61 static_assert(test());