summaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
Diffstat (limited to 'unittests')
-rw-r--r--unittests/ASTMatchers/ASTMatchersNodeTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/unittests/ASTMatchers/ASTMatchersNodeTest.cpp b/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
index dfaa441cd7..58c26eafd7 100644
--- a/unittests/ASTMatchers/ASTMatchersNodeTest.cpp
+++ b/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) {