MCPcopy Index your code
hub / github.com/cpplint/cpplint / testCheckCheckFalsePositives

Method testCheckCheckFalsePositives

cpplint_unittest.py:2588–2620  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2586 )
2587
2588 def testCheckCheckFalsePositives(self):
2589 self.TestLint("CHECK(some_iterator == obj.end());", "")
2590 self.TestLint("EXPECT_TRUE(some_iterator == obj.end());", "")
2591 self.TestLint("EXPECT_FALSE(some_iterator == obj.end());", "")
2592 self.TestLint("CHECK(some_pointer != NULL);", "")
2593 self.TestLint("EXPECT_TRUE(some_pointer != NULL);", "")
2594 self.TestLint("EXPECT_FALSE(some_pointer != NULL);", "")
2595
2596 self.TestLint("CHECK(CreateTestFile(dir, (1 << 20)));", "")
2597 self.TestLint("CHECK(CreateTestFile(dir, (1 >> 20)));", "")
2598
2599 self.TestLint("CHECK(x ^ (y < 42));", "")
2600 self.TestLint("CHECK((x > 42) ^ (x < 54));", "")
2601 self.TestLint("CHECK(a && b < 42);", "")
2602 self.TestLint("CHECK(42 < a && a < b);", "")
2603 self.TestLint("SOFT_CHECK(x > 42);", "")
2604
2605 self.TestMultiLineLint(
2606 """_STLP_DEFINE_BINARY_OP_CHECK(==, _OP_EQUAL);
2607 _STLP_DEFINE_BINARY_OP_CHECK(!=, _OP_NOT_EQUAL);
2608 _STLP_DEFINE_BINARY_OP_CHECK(<, _OP_LESS_THAN);
2609 _STLP_DEFINE_BINARY_OP_CHECK(<=, _OP_LESS_EQUAL);
2610 _STLP_DEFINE_BINARY_OP_CHECK(>, _OP_GREATER_THAN);
2611 _STLP_DEFINE_BINARY_OP_CHECK(>=, _OP_GREATER_EQUAL);
2612 _STLP_DEFINE_BINARY_OP_CHECK(+, _OP_PLUS);
2613 _STLP_DEFINE_BINARY_OP_CHECK(*, _OP_TIMES);
2614 _STLP_DEFINE_BINARY_OP_CHECK(/, _OP_DIVIDE);
2615 _STLP_DEFINE_BINARY_OP_CHECK(-, _OP_SUBTRACT);
2616 _STLP_DEFINE_BINARY_OP_CHECK(%, _OP_MOD);""",
2617 "",
2618 )
2619
2620 self.TestLint('CHECK(x < 42) << "Custom error message";', "")
2621
2622 # Alternative token to punctuation operator replacements
2623 def testCheckAltTokens(self):

Callers

nothing calls this directly

Calls 2

TestLintMethod · 0.80
TestMultiLineLintMethod · 0.80

Tested by

no test coverage detected