Unbreaking the MSVC 2012 build; however, these tests still fail on Windows.

llvm-svn: 222664
This commit is contained in:
Aaron Ballman 2014-11-24 17:22:32 +00:00
parent 098256c5e6
commit 54891e047f
1 changed files with 12 additions and 5 deletions

View File

@ -4634,36 +4634,43 @@ TEST(Matcher, IsExpansionInMainFileMatcher) {
EXPECT_TRUE(matches("class X {};", EXPECT_TRUE(matches("class X {};",
recordDecl(hasName("X"), isExpansionInMainFile()))); recordDecl(hasName("X"), isExpansionInMainFile())));
EXPECT_TRUE(notMatches("", recordDecl(isExpansionInMainFile()))); EXPECT_TRUE(notMatches("", recordDecl(isExpansionInMainFile())));
FileContentMappings M;
M.push_back(std::make_pair("/other", "class X {};"));
EXPECT_TRUE(matchesConditionally("#include <other>\n", EXPECT_TRUE(matchesConditionally("#include <other>\n",
recordDecl(isExpansionInMainFile()), false, recordDecl(isExpansionInMainFile()), false,
"-isystem/", {{"/other", "class X {};"}})); "-isystem/", M));
} }
TEST(Matcher, IsExpansionInSystemHeader) { TEST(Matcher, IsExpansionInSystemHeader) {
FileContentMappings M;
M.push_back(std::make_pair("/other", "class X {};"));
EXPECT_TRUE(matchesConditionally( EXPECT_TRUE(matchesConditionally(
"#include \"other\"\n", recordDecl(isExpansionInSystemHeader()), true, "#include \"other\"\n", recordDecl(isExpansionInSystemHeader()), true,
"-isystem/", {{"/other", "class X {};"}})); "-isystem/", M));
EXPECT_TRUE(matchesConditionally("#include \"other\"\n", EXPECT_TRUE(matchesConditionally("#include \"other\"\n",
recordDecl(isExpansionInSystemHeader()), recordDecl(isExpansionInSystemHeader()),
false, "-I/", {{"/other", "class X {};"}})); false, "-I/", M));
EXPECT_TRUE(notMatches("class X {};", EXPECT_TRUE(notMatches("class X {};",
recordDecl(isExpansionInSystemHeader()))); recordDecl(isExpansionInSystemHeader())));
EXPECT_TRUE(notMatches("", recordDecl(isExpansionInSystemHeader()))); EXPECT_TRUE(notMatches("", recordDecl(isExpansionInSystemHeader())));
} }
TEST(Matcher, IsExpansionInFileMatching) { 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( EXPECT_TRUE(matchesConditionally(
"#include <foo>\n" "#include <foo>\n"
"#include <bar>\n" "#include <bar>\n"
"class X {};", "class X {};",
recordDecl(isExpansionInFileMatching("b.*"), hasName("B")), true, recordDecl(isExpansionInFileMatching("b.*"), hasName("B")), true,
"-isystem/", {{"/foo", "class A {};"}, {"/bar", "class B {};"}})); "-isystem/", M));
EXPECT_TRUE(matchesConditionally( EXPECT_TRUE(matchesConditionally(
"#include <foo>\n" "#include <foo>\n"
"#include <bar>\n" "#include <bar>\n"
"class X {};", "class X {};",
recordDecl(isExpansionInFileMatching("f.*"), hasName("X")), false, recordDecl(isExpansionInFileMatching("f.*"), hasName("X")), false,
"-isystem/", {{"/foo", "class A {};"}, {"/bar", "class B {};"}})); "-isystem/", M));
} }
} // end namespace ast_matchers } // end namespace ast_matchers