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 glob | 6 import glob |
7 import json | 7 import json |
8 import os | 8 import os |
9 import re | 9 import re |
10 import subprocess | 10 import subprocess |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 def testSpecialFirstInclude6(self): | 127 def testSpecialFirstInclude6(self): |
128 mock_input_api = MockInputApi() | 128 mock_input_api = MockInputApi() |
129 contents = ['#include "some/other/path/foo_win.h"', | 129 contents = ['#include "some/other/path/foo_win.h"', |
130 '#include <set>', | 130 '#include <set>', |
131 '#include "a/header.h"'] | 131 '#include "a/header.h"'] |
132 mock_file = MockFile('some/path/foo_unittest_win.h', contents) | 132 mock_file = MockFile('some/path/foo_unittest_win.h', contents) |
133 warnings = PRESUBMIT._CheckIncludeOrderInFile( | 133 warnings = PRESUBMIT._CheckIncludeOrderInFile( |
134 mock_input_api, mock_file, range(1, len(contents) + 1)) | 134 mock_input_api, mock_file, range(1, len(contents) + 1)) |
135 self.assertEqual(0, len(warnings)) | 135 self.assertEqual(0, len(warnings)) |
136 | 136 |
| 137 def testSpecialFirstInclude7(self): |
| 138 mock_input_api = MockInputApi() |
| 139 contents = ['#include <windows.h>', |
| 140 '#include "some/path/foo.h"', |
| 141 '#include <set>', |
| 142 '#include "a/header.h"'] |
| 143 mock_file = MockFile('some/path/foo.cc', contents) |
| 144 warnings = PRESUBMIT._CheckIncludeOrderInFile( |
| 145 mock_input_api, mock_file, range(1, len(contents) + 1)) |
| 146 print warnings |
| 147 self.assertEqual(0, len(warnings)) |
| 148 |
137 def testOrderAlreadyWrong(self): | 149 def testOrderAlreadyWrong(self): |
138 scope = [(1, '#include "b.h"'), | 150 scope = [(1, '#include "b.h"'), |
139 (2, '#include "a.h"'), | 151 (2, '#include "a.h"'), |
140 (3, '#include "c.h"')] | 152 (3, '#include "c.h"')] |
141 mock_input_api = MockInputApi() | 153 mock_input_api = MockInputApi() |
142 warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api, | 154 warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api, |
143 '', [3]) | 155 '', [3]) |
144 self.assertEqual(0, len(warnings)) | 156 self.assertEqual(0, len(warnings)) |
145 | 157 |
146 def testConflictAdded1(self): | 158 def testConflictAdded1(self): |
(...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 self.assertTrue('HasInlineTag.java:4' in msgs[2].items) | 931 self.assertTrue('HasInlineTag.java:4' in msgs[2].items) |
920 | 932 |
921 # Util Log usage | 933 # Util Log usage |
922 self.assertEqual(2, len(msgs[3].items)) | 934 self.assertEqual(2, len(msgs[3].items)) |
923 self.assertTrue('HasAndroidLog.java:3' in msgs[3].items) | 935 self.assertTrue('HasAndroidLog.java:3' in msgs[3].items) |
924 self.assertTrue('IsInBasePackageButImportsLog.java:4' in msgs[3].items) | 936 self.assertTrue('IsInBasePackageButImportsLog.java:4' in msgs[3].items) |
925 | 937 |
926 | 938 |
927 if __name__ == '__main__': | 939 if __name__ == '__main__': |
928 unittest.main() | 940 unittest.main() |
OLD | NEW |