1 //===-- PathTests.cpp -------------------------------------------*- C++ -*-===//
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 //===----------------------------------------------------------------------===//
10 #include "support/Path.h"
11 #include "gmock/gmock.h"
12 #include "gtest/gtest.h"
17 TEST(PathTests
, IsAncestor
) {
18 EXPECT_TRUE(pathStartsWith(testPath("foo"), testPath("foo")));
19 EXPECT_TRUE(pathStartsWith(testPath("foo/"), testPath("foo")));
21 EXPECT_FALSE(pathStartsWith(testPath("foo"), testPath("fooz")));
22 EXPECT_FALSE(pathStartsWith(testPath("foo/"), testPath("fooz")));
24 EXPECT_TRUE(pathStartsWith(testPath("foo"), testPath("foo/bar")));
25 EXPECT_TRUE(pathStartsWith(testPath("foo/"), testPath("foo/bar")));
27 #ifdef CLANGD_PATH_CASE_INSENSITIVE
28 EXPECT_TRUE(pathStartsWith(testPath("fOo"), testPath("foo/bar")));
29 EXPECT_TRUE(pathStartsWith(testPath("foo"), testPath("fOo/bar")));
31 EXPECT_FALSE(pathStartsWith(testPath("fOo"), testPath("foo/bar")));
32 EXPECT_FALSE(pathStartsWith(testPath("foo"), testPath("fOo/bar")));