]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/std/experimental/filesystem/class.path/path.member/path.native.obs/c_str.pass.cpp
Vendor import of libc++ trunk r290819:
[FreeBSD/FreeBSD.git] / test / std / experimental / filesystem / class.path / path.member / path.native.obs / c_str.pass.cpp
1
2 //===----------------------------------------------------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
8 //
9 //===----------------------------------------------------------------------===//
10
11 // UNSUPPORTED: c++98, c++03
12
13 // <experimental/filesystem>
14
15 // class path
16
17 // const value_type* c_str() const noexcept;
18
19 #include <experimental/filesystem>
20 #include <type_traits>
21 #include <cassert>
22
23 #include "test_macros.h"
24 #include "filesystem_test_helper.hpp"
25
26 namespace fs = std::experimental::filesystem;
27
28 int main()
29 {
30   using namespace fs;
31   const char* const value = "hello world";
32   const std::string str_value = value;
33   { // Check signature
34     path p(value);
35     ASSERT_SAME_TYPE(path::value_type const*, decltype(p.c_str()));
36     ASSERT_NOEXCEPT(p.c_str());
37   }
38   {
39     path p(value);
40     assert(p.c_str() == str_value);
41     assert(p.native().c_str() == p.c_str());
42   }
43 }