1 | //===----------------------------------------------------------------------===// |
2 | // |
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 |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20, c++23 |
10 | |
11 | // <format> |
12 | |
13 | // template<class charT, class... Args> |
14 | // class basic_format_string<charT, type_identity_t<Args>...> |
15 | // |
16 | // basic_format_string(runtime-format-string<charT> s) noexcept : str(s.str) {} |
17 | // |
18 | // Additional testing is done in |
19 | // - libcxx/test/std/utilities/format/format.functions/format.runtime_format.pass.cpp |
20 | // - libcxx/test/std/utilities/format/format.functions/format.locale.runtime_format.pass.cpp |
21 | |
22 | #include <format> |
23 | #include <cassert> |
24 | |
25 | #include "test_macros.h" |
26 | |
27 | int main(int, char**) { |
28 | static_assert(noexcept(std::format_string<>{std::runtime_format(std::string_view{})})); |
29 | { |
30 | std::format_string<> s = std::runtime_format("}{invalid format string}{" ); |
31 | assert(s.get() == "}{invalid format string}{" ); |
32 | } |
33 | |
34 | #ifndef TEST_HAS_NO_WIDE_CHARACTERS |
35 | static_assert(noexcept(std::wformat_string<>{std::runtime_format(std::wstring_view{})})); |
36 | { |
37 | std::wformat_string<> s = std::runtime_format(L"}{invalid format string}{" ); |
38 | assert(s.get() == L"}{invalid format string}{" ); |
39 | } |
40 | #endif // TEST_HAS_NO_WIDE_CHARACTERS |
41 | |
42 | return 0; |
43 | } |
44 | |