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

Side by Side Diff: PRESUBMIT_test.py

Issue 1439833002: Remove //third_party/wtl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « PRESUBMIT.py ('k') | build/PRESUBMIT.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import re 6 import re
7 import unittest 7 import unittest
8 8
9 import PRESUBMIT 9 import PRESUBMIT
10 from PRESUBMIT_test_mocks import MockChange, MockFile 10 from PRESUBMIT_test_mocks import MockChange, MockFile
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 def testExcludedIncludes(self): 183 def testExcludedIncludes(self):
184 # #include <sys/...>'s can appear in any order. 184 # #include <sys/...>'s can appear in any order.
185 mock_input_api = MockInputApi() 185 mock_input_api = MockInputApi()
186 contents = ['#include <sys/b.h>', 186 contents = ['#include <sys/b.h>',
187 '#include <sys/a.h>'] 187 '#include <sys/a.h>']
188 mock_file = MockFile('', contents) 188 mock_file = MockFile('', contents)
189 warnings = PRESUBMIT._CheckIncludeOrderInFile( 189 warnings = PRESUBMIT._CheckIncludeOrderInFile(
190 mock_input_api, mock_file, range(1, len(contents) + 1)) 190 mock_input_api, mock_file, range(1, len(contents) + 1))
191 self.assertEqual(0, len(warnings)) 191 self.assertEqual(0, len(warnings))
192 192
193 contents = ['#include <atlbase.h>',
194 '#include <aaa.h>']
195 mock_file = MockFile('', contents)
196 warnings = PRESUBMIT._CheckIncludeOrderInFile(
197 mock_input_api, mock_file, range(1, len(contents) + 1))
198 self.assertEqual(0, len(warnings))
199
200 contents = ['#include "build/build_config.h"', 193 contents = ['#include "build/build_config.h"',
201 '#include "aaa.h"'] 194 '#include "aaa.h"']
202 mock_file = MockFile('', contents) 195 mock_file = MockFile('', contents)
203 warnings = PRESUBMIT._CheckIncludeOrderInFile( 196 warnings = PRESUBMIT._CheckIncludeOrderInFile(
204 mock_input_api, mock_file, range(1, len(contents) + 1)) 197 mock_input_api, mock_file, range(1, len(contents) + 1))
205 self.assertEqual(0, len(warnings)) 198 self.assertEqual(0, len(warnings))
206 199
207 def testCheckOnlyCFiles(self): 200 def testCheckOnlyCFiles(self):
208 mock_input_api = MockInputApi() 201 mock_input_api = MockInputApi()
209 mock_output_api = MockOutputApi() 202 mock_output_api = MockOutputApi()
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 def testValidIfDefinedMacroNames(self): 341 def testValidIfDefinedMacroNames(self):
349 lines = ['#if defined(FOO)', 342 lines = ['#if defined(FOO)',
350 '#ifdef BAR',] 343 '#ifdef BAR',]
351 errors = PRESUBMIT._CheckForInvalidIfDefinedMacrosInFile( 344 errors = PRESUBMIT._CheckForInvalidIfDefinedMacrosInFile(
352 MockInputApi(), MockFile('some/path/source.cc', lines)) 345 MockInputApi(), MockFile('some/path/source.cc', lines))
353 self.assertEqual(0, len(errors)) 346 self.assertEqual(0, len(errors))
354 347
355 348
356 if __name__ == '__main__': 349 if __name__ == '__main__':
357 unittest.main() 350 unittest.main()
OLDNEW
« no previous file with comments | « PRESUBMIT.py ('k') | build/PRESUBMIT.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698