1 //===-- Unittests for rmdir -----------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "src/errno/libc_errno.h"
10 #include "src/sys/stat/mkdir.h"
11 #include "src/unistd/rmdir.h"
12 #include "test/UnitTest/ErrnoSetterMatcher.h"
13 #include "test/UnitTest/Test.h"
17 TEST(LlvmLibcRmdirTest
, CreateAndRemove
) {
18 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds
;
19 constexpr const char *TEST_DIR
= "testdata/rmdir.testdir";
20 ASSERT_THAT(LIBC_NAMESPACE::mkdir(TEST_DIR
, S_IRWXU
), Succeeds(0));
21 ASSERT_THAT(LIBC_NAMESPACE::rmdir(TEST_DIR
), Succeeds(0));
24 TEST(LlvmLibcRmdirTest
, RemoveNonExistentDir
) {
25 using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails
;
26 ASSERT_THAT(LIBC_NAMESPACE::rmdir("testdata/non-existent-dir"),