Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: PRESUBMIT_test.py

Issue 2568473002: Presubmit: Skip third_party for fwd decl warning (Closed)
Patch Set: Rebase + escape backslashes properly Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « PRESUBMIT.py ('k') | PRESUBMIT_test_mocks.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT_test.py
diff --git a/PRESUBMIT_test.py b/PRESUBMIT_test.py
index acb6adc48f44824c5dadecbf4847cbfd83529440..e5f6215224c6e17fb49bf18294b57ca9af34d5b2 100755
--- a/PRESUBMIT_test.py
+++ b/PRESUBMIT_test.py
@@ -1115,11 +1115,14 @@ class HardcodedGoogleHostsTest(unittest.TestCase):
class ForwardDeclarationTest(unittest.TestCase):
- def testCheckHeadersOnly(self):
+ def testCheckHeadersOnlyOutsideThirdParty(self):
mock_input_api = MockInputApi()
mock_input_api.files = [
MockAffectedFile('somewhere/file.cc', [
'class DummyClass;'
+ ]),
+ MockAffectedFile('third_party/header.h', [
+ 'class DummyClass;'
])
]
warnings = PRESUBMIT._CheckUselessForwardDeclarations(mock_input_api,
@@ -1130,9 +1133,9 @@ class ForwardDeclarationTest(unittest.TestCase):
mock_input_api = MockInputApi()
mock_input_api.files = [
MockAffectedFile('somewhere/header.h', [
- 'class SomeClass {'
- ' protected:'
- ' class NotAMatch;'
+ 'class SomeClass {',
+ ' protected:',
+ ' class NotAMatch;',
'};'
])
]
@@ -1162,12 +1165,28 @@ class ForwardDeclarationTest(unittest.TestCase):
'struct DummyStruct;',
'class UsefulClass;',
'std::unique_ptr<UsefulClass> p;'
- ]),
+ ])
]
warnings = PRESUBMIT._CheckUselessForwardDeclarations(mock_input_api,
MockOutputApi())
self.assertEqual(2, len(warnings))
+ def testBlinkHeaders(self):
+ mock_input_api = MockInputApi()
+ mock_input_api.files = [
+ MockAffectedFile('third_party/WebKit/header.h', [
+ 'class DummyClass;',
+ 'struct DummyStruct;',
+ ]),
+ MockAffectedFile('third_party\\WebKit\\header.h', [
+ 'class DummyClass;',
+ 'struct DummyStruct;',
+ ])
+ ]
+ warnings = PRESUBMIT._CheckUselessForwardDeclarations(mock_input_api,
+ MockOutputApi())
+ self.assertEqual(4, len(warnings))
+
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « PRESUBMIT.py ('k') | PRESUBMIT_test_mocks.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698