summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support/FileCheckTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/Support/FileCheckTest.cpp')
-rw-r--r--llvm/unittests/Support/FileCheckTest.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/llvm/unittests/Support/FileCheckTest.cpp b/llvm/unittests/Support/FileCheckTest.cpp
index dc89eef3256..b9970ffc1f7 100644
--- a/llvm/unittests/Support/FileCheckTest.cpp
+++ b/llvm/unittests/Support/FileCheckTest.cpp
@@ -257,11 +257,11 @@ TEST_F(FileCheckTest, ParseExpr) {
// Unacceptable variable.
EXPECT_TRUE(Tester.parseSubstExpect("10VAR"));
EXPECT_TRUE(Tester.parseSubstExpect("@FOO"));
- EXPECT_TRUE(Tester.parseSubstExpect("UNDEF"));
// Only valid variable.
EXPECT_FALSE(Tester.parseSubstExpect("@LINE"));
EXPECT_FALSE(Tester.parseSubstExpect("FOO"));
+ EXPECT_FALSE(Tester.parseSubstExpect("UNDEF"));
// Use variable defined on same line.
EXPECT_FALSE(Tester.parsePatternExpect("[[#LINE1VAR:]]"));
@@ -471,9 +471,14 @@ TEST_F(FileCheckTest, FileCheckContext) {
P = FileCheckPattern(Check::CheckPlain, &Cxt, 2);
Expression = P.parseNumericSubstitutionBlock(LocalNumVarRef,
DefinedNumericVariable, SM);
- EXPECT_TRUE(errorToBool(Expression.takeError()));
+ EXPECT_TRUE(bool(Expression));
+ ExpressionVal = (*Expression)->eval();
+ EXPECT_TRUE(errorToBool(ExpressionVal.takeError()));
EmptyVar = Cxt.getPatternVarValue(EmptyVarStr);
EXPECT_TRUE(errorToBool(EmptyVar.takeError()));
+ // Clear again because parseNumericSubstitutionBlock would have created a
+ // dummy variable and stored it in GlobalNumericVariableTable.
+ Cxt.clearLocalVars();
// Redefine global variables and check variables are defined again.
GlobalDefines.emplace_back(std::string("$GlobalVar=BAR"));
OpenPOWER on IntegriCloud