1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // UNSUPPORTED: c++98, c++03
12 // <experimental/filesystem>
14 // void create_directory_symlink(const path& existing_symlink, const path& new_symlink);
15 // void create_directory_symlink(const path& existing_symlink, const path& new_symlink,
16 // error_code& ec) noexcept;
18 #include "filesystem_include.hpp"
21 #include "test_macros.h"
22 #include "rapid-cxx-test.hpp"
23 #include "filesystem_test_helper.hpp"
27 TEST_SUITE(filesystem_create_directory_symlink_test_suite)
29 TEST_CASE(test_signatures)
31 const path p; ((void)p);
32 std::error_code ec; ((void)ec);
33 ASSERT_NOT_NOEXCEPT(fs::create_directory_symlink(p, p));
34 ASSERT_NOEXCEPT(fs::create_directory_symlink(p, p, ec));
37 TEST_CASE(test_error_reporting)
40 const path file = env.create_file("file1", 42);
41 const path file2 = env.create_file("file2", 55);
42 const path sym = env.create_symlink(file, "sym");
43 { // destination exists
45 fs::create_directory_symlink(sym, file2, ec);
50 TEST_CASE(create_directory_symlink_basic)
53 const path dir = env.create_dir("dir");
54 const path dir_sym = env.create_symlink(dir, "dir_sym");
56 const path dest = env.make_env_path("dest1");
58 fs::create_directory_symlink(dir_sym, dest, ec);
60 TEST_CHECK(is_symlink(dest));
61 TEST_CHECK(equivalent(dest, dir));