diff options
author | Aaron Ballman <aaron@aaronballman.com> | 2014-11-24 17:39:44 +0000 |
---|---|---|
committer | Aaron Ballman <aaron@aaronballman.com> | 2014-11-24 17:39:44 +0000 |
commit | 14951ec70786dc6fd34db9da98fac8484bf55799 (patch) | |
tree | 9b6e298f3c93227beb248de8fb26026e488afa2f /unittests | |
parent | e5f5ee69050b38ea6646fcae08bc2c34aeed0624 (diff) |
Reverting r222646; the tests do not pass on Windows. Also reverts r222664, which was required for r222646 to compile with Visual Studio 2012.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@222667 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r-- | unittests/ASTMatchers/ASTMatchersTest.cpp | 48 | ||||
-rw-r--r-- | unittests/ASTMatchers/ASTMatchersTest.h | 12 |
2 files changed, 5 insertions, 55 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersTest.cpp b/unittests/ASTMatchers/ASTMatchersTest.cpp index ba66a2da9e..c88a197643 100644 --- a/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -4625,53 +4625,5 @@ TEST(EqualsBoundNodeMatcher, UnlessDescendantsOfAncestorsMatch) { .bind("data"))); } -TEST(TypeDefDeclMatcher, Match) { - EXPECT_TRUE(matches("typedef int typedefDeclTest;", - typedefDecl(hasName("typedefDeclTest")))); -} - -TEST(Matcher, IsExpansionInMainFileMatcher) { - EXPECT_TRUE(matches("class X {};", - recordDecl(hasName("X"), isExpansionInMainFile()))); - EXPECT_TRUE(notMatches("", recordDecl(isExpansionInMainFile()))); - FileContentMappings M; - M.push_back(std::make_pair("/other", "class X {};")); - EXPECT_TRUE(matchesConditionally("#include <other>\n", - recordDecl(isExpansionInMainFile()), false, - "-isystem/", M)); -} - -TEST(Matcher, IsExpansionInSystemHeader) { - FileContentMappings M; - M.push_back(std::make_pair("/other", "class X {};")); - EXPECT_TRUE(matchesConditionally( - "#include \"other\"\n", recordDecl(isExpansionInSystemHeader()), true, - "-isystem/", M)); - EXPECT_TRUE(matchesConditionally("#include \"other\"\n", - recordDecl(isExpansionInSystemHeader()), - false, "-I/", M)); - EXPECT_TRUE(notMatches("class X {};", - recordDecl(isExpansionInSystemHeader()))); - EXPECT_TRUE(notMatches("", recordDecl(isExpansionInSystemHeader()))); -} - -TEST(Matcher, IsExpansionInFileMatching) { - FileContentMappings M; - M.push_back(std::make_pair("/foo", "class A {};")); - M.push_back(std::make_pair("/bar", "class B {};")); - EXPECT_TRUE(matchesConditionally( - "#include <foo>\n" - "#include <bar>\n" - "class X {};", - recordDecl(isExpansionInFileMatching("b.*"), hasName("B")), true, - "-isystem/", M)); - EXPECT_TRUE(matchesConditionally( - "#include <foo>\n" - "#include <bar>\n" - "class X {};", - recordDecl(isExpansionInFileMatching("f.*"), hasName("X")), false, - "-isystem/", M)); -} - } // end namespace ast_matchers } // end namespace clang diff --git a/unittests/ASTMatchers/ASTMatchersTest.h b/unittests/ASTMatchers/ASTMatchersTest.h index a2ab9feee2..2e5b3da5a5 100644 --- a/unittests/ASTMatchers/ASTMatchersTest.h +++ b/unittests/ASTMatchers/ASTMatchersTest.h @@ -22,7 +22,6 @@ using clang::tooling::buildASTFromCodeWithArgs; using clang::tooling::newFrontendActionFactory; using clang::tooling::runToolOnCodeWithArgs; using clang::tooling::FrontendActionFactory; -using clang::tooling::FileContentMappings; class BoundNodesCallback { public: @@ -59,10 +58,10 @@ private: }; template <typename T> -testing::AssertionResult matchesConditionally( - const std::string &Code, const T &AMatcher, bool ExpectMatch, - llvm::StringRef CompileArg, - const FileContentMappings &VirtualMappedFiles = FileContentMappings()) { +testing::AssertionResult matchesConditionally(const std::string &Code, + const T &AMatcher, + bool ExpectMatch, + llvm::StringRef CompileArg) { bool Found = false, DynamicFound = false; MatchFinder Finder; VerifyMatch VerifyFound(nullptr, &Found); @@ -74,8 +73,7 @@ testing::AssertionResult matchesConditionally( newFrontendActionFactory(&Finder)); // Some tests use typeof, which is a gnu extension. std::vector<std::string> Args(1, CompileArg); - if (!runToolOnCodeWithArgs(Factory->create(), Code, Args, "input.cc", - VirtualMappedFiles)) { + if (!runToolOnCodeWithArgs(Factory->create(), Code, Args)) { return testing::AssertionFailure() << "Parsing error in \"" << Code << "\""; } if (Found != DynamicFound) { |