summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/unittests/cpp11-migrate/IncludeExcludeTest.cpp
diff options
context:
space:
mode:
authorAriel J. Bernal <ariel.j.bernal@intel.com>2013-07-31 04:00:28 +0000
committerAriel J. Bernal <ariel.j.bernal@intel.com>2013-07-31 04:00:28 +0000
commitdec84e11399e4dab21755f23da5b0417edf05196 (patch)
tree8636b2832cd20186ef01b19cfba04d291834a6d3 /clang-tools-extra/unittests/cpp11-migrate/IncludeExcludeTest.cpp
parent3e0afb87b2d2ccbc30d8f265388753cd8690c3d7 (diff)
downloadbcm5719-llvm-dec84e11399e4dab21755f23da5b0417edf05196.tar.gz
bcm5719-llvm-dec84e11399e4dab21755f23da5b0417edf05196.zip
Fixed path differences when using include/exclude headers
Added function for removing relative operators from input paths. llvm-svn: 187481
Diffstat (limited to 'clang-tools-extra/unittests/cpp11-migrate/IncludeExcludeTest.cpp')
-rw-r--r--clang-tools-extra/unittests/cpp11-migrate/IncludeExcludeTest.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/cpp11-migrate/IncludeExcludeTest.cpp b/clang-tools-extra/unittests/cpp11-migrate/IncludeExcludeTest.cpp
index 7aea471c21a..ed0e9f70eab 100644
--- a/clang-tools-extra/unittests/cpp11-migrate/IncludeExcludeTest.cpp
+++ b/clang-tools-extra/unittests/cpp11-migrate/IncludeExcludeTest.cpp
@@ -52,6 +52,23 @@ TEST(IncludeExcludeTest, ParseString) {
EXPECT_FALSE(IEManager.isFileIncluded("c/c2/c3/f.cpp"));
}
+TEST(IncludeExcludeTest, ParseStringCases) {
+ IncludeExcludeInfo IEManager;
+ llvm::error_code Err = IEManager.readListFromString(
+ /*include=*/ "a/.,b/b2/,c/c2/c3/../../c4/,d/d2/./d3/,/e/e2/.",
+ /*exclude=*/ "");
+
+ ASSERT_EQ(Err, llvm::error_code::success());
+
+ EXPECT_TRUE(IEManager.isFileIncluded("a/f.cpp"));
+ EXPECT_TRUE(IEManager.isFileIncluded("b/b2/f.cpp"));
+ EXPECT_TRUE(IEManager.isFileIncluded("c/c4/f.cpp"));
+ EXPECT_TRUE(IEManager.isFileIncluded("d/d2/d3/f.cpp"));
+ EXPECT_TRUE(IEManager.isFileIncluded("/e/e2/f.cpp"));
+
+ EXPECT_FALSE(IEManager.isFileIncluded("c/c2/c3/f.cpp"));
+}
+
// Utility for creating and filling files with data for IncludeExcludeFileTest
// tests.
struct InputFiles {
OpenPOWER on IntegriCloud