| OLD | NEW |
| 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 os | 6 import os |
| 7 import re | 7 import re |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 import PRESUBMIT | 10 import PRESUBMIT |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 def testSpecialFirstInclude5(self): | 174 def testSpecialFirstInclude5(self): |
| 175 mock_input_api = MockInputApi() | 175 mock_input_api = MockInputApi() |
| 176 contents = ['#include "some/other/path/foo.h"', | 176 contents = ['#include "some/other/path/foo.h"', |
| 177 '#include "a/header.h"'] | 177 '#include "a/header.h"'] |
| 178 mock_file = MockFile('some/path/foo-suffix.h', contents) | 178 mock_file = MockFile('some/path/foo-suffix.h', contents) |
| 179 warnings = PRESUBMIT._CheckIncludeOrderInFile( | 179 warnings = PRESUBMIT._CheckIncludeOrderInFile( |
| 180 mock_input_api, mock_file, range(1, len(contents) + 1)) | 180 mock_input_api, mock_file, range(1, len(contents) + 1)) |
| 181 self.assertEqual(0, len(warnings)) | 181 self.assertEqual(0, len(warnings)) |
| 182 | 182 |
| 183 def testSpecialFirstInclude6(self): |
| 184 mock_input_api = MockInputApi() |
| 185 contents = ['#include "some/other/path/foo_win.h"', |
| 186 '#include <set>', |
| 187 '#include "a/header.h"'] |
| 188 mock_file = MockFile('some/path/foo_unittest_win.h', contents) |
| 189 warnings = PRESUBMIT._CheckIncludeOrderInFile( |
| 190 mock_input_api, mock_file, range(1, len(contents) + 1)) |
| 191 self.assertEqual(0, len(warnings)) |
| 192 |
| 183 def testOrderAlreadyWrong(self): | 193 def testOrderAlreadyWrong(self): |
| 184 scope = [(1, '#include "b.h"'), | 194 scope = [(1, '#include "b.h"'), |
| 185 (2, '#include "a.h"'), | 195 (2, '#include "a.h"'), |
| 186 (3, '#include "c.h"')] | 196 (3, '#include "c.h"')] |
| 187 mock_input_api = MockInputApi() | 197 mock_input_api = MockInputApi() |
| 188 warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api, | 198 warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api, |
| 189 '', [3]) | 199 '', [3]) |
| 190 self.assertEqual(0, len(warnings)) | 200 self.assertEqual(0, len(warnings)) |
| 191 | 201 |
| 192 def testConflictAdded1(self): | 202 def testConflictAdded1(self): |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 'policy/DEPS', | 425 'policy/DEPS', |
| 416 'sandbox/DEPS', | 426 'sandbox/DEPS', |
| 417 'tools/memory_watcher/DEPS', | 427 'tools/memory_watcher/DEPS', |
| 418 'third_party/lss/DEPS', | 428 'third_party/lss/DEPS', |
| 419 ]) | 429 ]) |
| 420 self.assertEqual(expected, files_to_check); | 430 self.assertEqual(expected, files_to_check); |
| 421 | 431 |
| 422 | 432 |
| 423 if __name__ == '__main__': | 433 if __name__ == '__main__': |
| 424 unittest.main() | 434 unittest.main() |
| OLD | NEW |