| Index: PRESUBMIT_test.py
|
| diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
|
| index 3bebc678c616978a8494da5cee552004cc2b90a7..b24a1ef1307b78a8b6d4ab0d6170752e455521eb 100755
|
| --- a/PRESUBMIT_test.py
|
| +++ b/PRESUBMIT_test.py
|
| @@ -393,6 +393,54 @@ class InvalidOSMacroNamesTest(unittest.TestCase):
|
| self.assertEqual(0, len(errors))
|
|
|
|
|
| +class CheckContradictoryNotreachedUseTest(unittest.TestCase):
|
| + def testValid(self):
|
| + lines = ['{',
|
| + ' // NOTREACHED();',
|
| + ' /* NOTREACHED(); */',
|
| + " char a = '\\\\', b = '\\0', c = '\\'';",
|
| + ' char d[] = "NOTREACHED();";',
|
| + ' NOTREACHED(); // blah',
|
| + ' /* comment */',
|
| + ' // line continuation \\',
|
| + ' still inside comment',
|
| + ' // line continuation with MS-DOS line end \\\r',
|
| + ' still inside comment',
|
| + ' // comment followed by empty line',
|
| + '',
|
| + ' ;; ; ;;;',
|
| + '}',
|
| + 'switch (i) {',
|
| + ' case 7: NOTREACHED(); break;',
|
| + '}']
|
| + output = PRESUBMIT._CheckContradictoryNotreachedUseInFile(
|
| + MockInputApi(), MockFile('some/path/foo_platform.cc', lines))
|
| + self.assertEqual(0, len(output))
|
| +
|
| + def testInvalid(self):
|
| + lines = ['{',
|
| + ' NOTREACHED();',
|
| + ' return;',
|
| + '}',
|
| + '{',
|
| + ' NOTREACHED();',
|
| + ' /* */',
|
| + ' return;',
|
| + ' /* */',
|
| + '}',
|
| + '{',
|
| + ' NOTREACHED();',
|
| + ' // trailing space, not a line continuation \\ ',
|
| + ' return;',
|
| + '}',
|
| + 'switch (i) {',
|
| + ' case 7: NOTREACHED(); some_thing(); break;',
|
| + '}']
|
| + output = PRESUBMIT._CheckContradictoryNotreachedUseInFile(
|
| + MockInputApi(), MockFile('some/path/foo_platform.cc', lines))
|
| + self.assertEqual(4, len(output))
|
| +
|
| +
|
| class CheckAddedDepsHaveTetsApprovalsTest(unittest.TestCase):
|
| def testFilesToCheckForIncomingDeps(self):
|
| changed_lines = [
|
|
|