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 |
10 | // UNSUPPORTED: availability-filesystem-missing |
11 | |
12 | // <filesystem> |
13 | |
14 | // class path |
15 | |
16 | // const string_type& native() const noexcept; |
17 | |
18 | #include <filesystem> |
19 | #include <cassert> |
20 | #include <string> |
21 | #include <type_traits> |
22 | |
23 | #include "assert_macros.h" |
24 | #include "test_macros.h" |
25 | namespace fs = std::filesystem; |
26 | |
27 | int main(int, char**) { |
28 | using namespace fs; |
29 | const char* const value = "hello world" ; |
30 | std::string value_str(value); |
31 | fs::path::string_type pathstr_value(value_str.begin(), value_str.end()); |
32 | { // Check signature |
33 | path p(value); |
34 | ASSERT_SAME_TYPE(path::string_type const&, decltype(p.native())); |
35 | ASSERT_NOEXCEPT(p.native()); |
36 | } |
37 | { // native() is tested elsewhere |
38 | path p(value); |
39 | assert(p.native() == pathstr_value); |
40 | } |
41 | |
42 | return 0; |
43 | } |
44 | |