blob: 9dac53a98a9f68f82166eeed5bd658ce92a86b93 [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
20#include <android-base/scopeguard.h>
21#include <android-base/test_utils.h>
22#include <gtest/gtest.h>
23
24#include "Common.h"
25
26using namespace std::string_literals;
27
28TEST(SyspropTest, CreateNestedDirectoryTest) {
29 TemporaryDir temp_dir;
30
31 ASSERT_FALSE(IsDirectory(temp_dir.path + "/test_dir/test_dir2/test_dir3"s));
32 ASSERT_TRUE(
33 CreateDirectories(temp_dir.path + "/test_dir/test_dir2/test_dir3"s));
34 ASSERT_TRUE(IsDirectory(temp_dir.path + "/test_dir/test_dir2/test_dir3"s));
35
36 rmdir((temp_dir.path + "/test_dir/test_dir2/test_dir3"s).c_str());
37 rmdir((temp_dir.path + "/test_dir/test_dir2"s).c_str());
38 rmdir((temp_dir.path + "/test_dir"s).c_str());
39}