blob: 650e4156b076ddd1478fbf097918f1f2ad719853 [file] [log] [blame]
Inseob Kimade45e22018-08-29 19:08:35 +09001/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <unistd.h>
18#include <string>
19
Inseob Kimade45e22018-08-29 19:08:35 +090020#include <android-base/test_utils.h>
21#include <gtest/gtest.h>
22
23#include "Common.h"
24
25using namespace std::string_literals;
26
27TEST(SyspropTest, CreateNestedDirectoryTest) {
28 TemporaryDir temp_dir;
29
30 ASSERT_FALSE(IsDirectory(temp_dir.path + "/test_dir/test_dir2/test_dir3"s));
31 ASSERT_TRUE(
32 CreateDirectories(temp_dir.path + "/test_dir/test_dir2/test_dir3"s));
33 ASSERT_TRUE(IsDirectory(temp_dir.path + "/test_dir/test_dir2/test_dir3"s));
34
35 rmdir((temp_dir.path + "/test_dir/test_dir2/test_dir3"s).c_str());
36 rmdir((temp_dir.path + "/test_dir/test_dir2"s).c_str());
37 rmdir((temp_dir.path + "/test_dir"s).c_str());
38}