(self)
| 448 | |
| 449 | # Test line length check. |
| 450 | def testLineLengthCheck(self): |
| 451 | self.TestLint("// Hello", "") |
| 452 | self.TestLint( |
| 453 | "// x" + " x" * 40, |
| 454 | "Lines should be <= 80 characters long [whitespace/line_length] [2]", |
| 455 | ) |
| 456 | self.TestLint( |
| 457 | "// x" + " x" * 50, |
| 458 | "Lines should be <= 80 characters long [whitespace/line_length] [2]", |
| 459 | ) |
| 460 | self.TestLint("// //some/path/to/f" + ("i" * 100) + "le", "") |
| 461 | self.TestLint("// //some/path/to/f" + ("i" * 100) + "le", "") |
| 462 | self.TestLint( |
| 463 | "// //some/path/to/f" + ("i" * 50) + "le and some comments", |
| 464 | "Lines should be <= 80 characters long [whitespace/line_length] [2]", |
| 465 | ) |
| 466 | self.TestLint("// http://g" + ("o" * 100) + "gle.com/", "") |
| 467 | self.TestLint("// https://g" + ("o" * 100) + "gle.com/", "") |
| 468 | self.TestLint( |
| 469 | "// https://g" + ("o" * 60) + "gle.com/ and some comments", |
| 470 | "Lines should be <= 80 characters long [whitespace/line_length] [2]", |
| 471 | ) |
| 472 | self.TestLint("// Read https://g" + ("o" * 60) + "gle.com/", "") |
| 473 | self.TestLint("// $Id: g" + ("o" * 80) + "gle.cc#1 $", "") |
| 474 | self.TestLint( |
| 475 | "// $Id: g" + ("o" * 80) + "gle.cc#1", |
| 476 | "Lines should be <= 80 characters long [whitespace/line_length] [2]", |
| 477 | ) |
| 478 | self.TestMultiLineLint( |
| 479 | 'static const char kCStr[] = "g' + ("o" * 50) + 'gle";\n', |
| 480 | "Lines should be <= 80 characters long [whitespace/line_length] [2]", |
| 481 | ) |
| 482 | self.TestMultiLineLint( |
| 483 | 'static const char kRawStr[] = R"(g' + ("o" * 50) + 'gle)";\n', "" |
| 484 | ) # no warning because raw string content is elided |
| 485 | self.TestMultiLineLint( |
| 486 | 'static const char kMultiLineRawStr[] = R"(\ng' + ("o" * 80) + 'gle\n)";', "" |
| 487 | ) |
| 488 | self.TestMultiLineLint( |
| 489 | "static const char kL" + ("o" * 50) + 'ngIdentifier[] = R"()";\n', |
| 490 | "Lines should be <= 80 characters long [whitespace/line_length] [2]", |
| 491 | ) |
| 492 | self.TestLint(" /// @copydoc " + ("o" * (cpplint._line_length * 2)), "") |
| 493 | self.TestLint(" /// @copydetails " + ("o" * (cpplint._line_length * 2)), "") |
| 494 | self.TestLint(" /// @copybrief " + ("o" * (cpplint._line_length * 2)), "") |
| 495 | |
| 496 | # Test error suppression annotations. |
| 497 | def testErrorSuppression(self): |
nothing calls this directly
no test coverage detected