[AVR] Fix LLD test (#106739)
[llvm-project.git] / clang-tools-extra / clangd / unittests / support / PathTests.cpp
blob599c76926d30de20058153402e40ea78ad39003c
1 //===-- PathTests.cpp -------------------------------------------*- C++ -*-===//
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 "TestFS.h"
10 #include "support/Path.h"
11 #include "gmock/gmock.h"
12 #include "gtest/gtest.h"
14 namespace clang {
15 namespace clangd {
16 namespace {
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")));
30 #else
31 EXPECT_FALSE(pathStartsWith(testPath("fOo"), testPath("foo/bar")));
32 EXPECT_FALSE(pathStartsWith(testPath("foo"), testPath("fOo/bar")));
33 #endif
35 } // namespace
36 } // namespace clangd
37 } // namespace clang