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