summaryrefslogtreecommitdiffstats
path: root/clang/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests')
-rw-r--r--clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
index dfaa441cd76..58c26eafd7e 100644
--- a/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ b/clang/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
@@ -666,6 +666,12 @@ TEST(Matcher, IntegerLiterals) {
EXPECT_TRUE(notMatches("int i = 'a';", HasIntLiteral));
EXPECT_TRUE(notMatches("int i = 1e10;", HasIntLiteral));
EXPECT_TRUE(notMatches("int i = 10.0;", HasIntLiteral));
+
+ // Negative integers.
+ EXPECT_TRUE(
+ matches("int i = -10;",
+ unaryOperator(hasOperatorName("-"),
+ hasUnaryOperand(integerLiteral(equals(10))))));
}
TEST(Matcher, FloatLiterals) {
OpenPOWER on IntegriCloud