[ELF] Remove redundant isExported computation
[llvm-project.git] / libc / test / src / sys / stat / mkdirat_test.cpp
blob85e013de234e76aed8a35a44fc234230afc34d32
1 //===-- Unittests for mkdirat ---------------------------------------------===//
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 //===----------------------------------------------------------------------===//
9 #include "src/sys/stat/mkdirat.h"
10 #include "src/unistd/rmdir.h"
11 #include "test/UnitTest/ErrnoSetterMatcher.h"
12 #include "test/UnitTest/Test.h"
14 #include "hdr/fcntl_macros.h"
16 TEST(LlvmLibcMkdiratTest, CreateAndRemove) {
17 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
18 constexpr const char *FILENAME = "testdata/mkdirat.testdir";
19 auto TEST_DIR = libc_make_test_file_path(FILENAME);
20 ASSERT_THAT(LIBC_NAMESPACE::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU),
21 Succeeds(0));
22 ASSERT_THAT(LIBC_NAMESPACE::rmdir(TEST_DIR), Succeeds(0));
25 TEST(LlvmLibcMkdiratTest, BadPath) {
26 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
27 ASSERT_THAT(
28 LIBC_NAMESPACE::mkdirat(AT_FDCWD, "non-existent-dir/test", S_IRWXU),
29 Fails(ENOENT));