[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / libc / test / src / sys / stat / mkdirat_test.cpp
blob2e742009a0b19d15f77806f907639dbae3b6549e
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/ErrnoSetterMatcher.h"
12 #include "test/UnitTest/Test.h"
13 #include "utils/testutils/FDReader.h"
15 #include <errno.h>
16 #include <fcntl.h>
18 TEST(LlvmLibcMkdiratTest, CreateAndRemove) {
19 using __llvm_libc::testing::ErrnoSetterMatcher::Succeeds;
20 constexpr const char *TEST_DIR = "testdata/mkdirat.testdir";
21 ASSERT_THAT(__llvm_libc::mkdirat(AT_FDCWD, TEST_DIR, S_IRWXU), Succeeds(0));
22 ASSERT_THAT(__llvm_libc::rmdir(TEST_DIR), Succeeds(0));
25 TEST(LlvmLibcMkdiratTest, BadPath) {
26 using __llvm_libc::testing::ErrnoSetterMatcher::Fails;
27 ASSERT_THAT(__llvm_libc::mkdirat(AT_FDCWD, "non-existent-dir/test", S_IRWXU),
28 Fails(ENOENT));