diff options
Diffstat (limited to 'unittests/Lex/HeaderSearchTest.cpp')
-rw-r--r-- | unittests/Lex/HeaderSearchTest.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/unittests/Lex/HeaderSearchTest.cpp b/unittests/Lex/HeaderSearchTest.cpp index 060135bc73..5bcdd9efd1 100644 --- a/unittests/Lex/HeaderSearchTest.cpp +++ b/unittests/Lex/HeaderSearchTest.cpp @@ -1,9 +1,8 @@ //===- unittests/Lex/HeaderSearchTest.cpp ------ HeaderSearch tests -------===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -12,12 +11,12 @@ #include "clang/Basic/DiagnosticOptions.h" #include "clang/Basic/FileManager.h" #include "clang/Basic/LangOptions.h" -#include "clang/Basic/MemoryBufferCache.h" #include "clang/Basic/SourceManager.h" #include "clang/Basic/TargetInfo.h" #include "clang/Basic/TargetOptions.h" #include "clang/Lex/HeaderSearch.h" #include "clang/Lex/HeaderSearchOptions.h" +#include "clang/Serialization/InMemoryModuleCache.h" #include "gtest/gtest.h" namespace clang { @@ -92,5 +91,21 @@ TEST_F(HeaderSearchTest, Dots) { "z"); } +#ifdef _WIN32 +TEST_F(HeaderSearchTest, BackSlash) { + addSearchDir("C:\\x\\y\\"); + EXPECT_EQ(Search.suggestPathToFileForDiagnostics("C:\\x\\y\\z\\t", + /*WorkingDir=*/""), + "z/t"); +} +#endif + +TEST_F(HeaderSearchTest, DotDotsWithAbsPath) { + addSearchDir("/x/../y/"); + EXPECT_EQ(Search.suggestPathToFileForDiagnostics("/y/z", + /*WorkingDir=*/""), + "z"); +} + } // namespace } // namespace clang |