Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 sys | 7 import sys |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 import PRESUBMIT | 10 import PRESUBMIT |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 def testNakedSourceSetInSDKBuildFile(self): | 194 def testNakedSourceSetInSDKBuildFile(self): |
| 195 """Tests that a source_set within an SDK buildfile is flagged.""" | 195 """Tests that a source_set within an SDK buildfile is flagged.""" |
| 196 mock_input_api = self.inputApiContainingFileWithSourceSets( | 196 mock_input_api = self.inputApiContainingFileWithSourceSets( |
| 197 _SDK_BUILD_FILE, | 197 _SDK_BUILD_FILE, |
| 198 [ 'mojo_sdk_source_set(', 'source_set(' ]) | 198 [ 'mojo_sdk_source_set(', 'source_set(' ]) |
| 199 warnings = PRESUBMIT._BuildFileChecks(mock_input_api, MockOutputApi()) | 199 warnings = PRESUBMIT._BuildFileChecks(mock_input_api, MockOutputApi()) |
| 200 | 200 |
| 201 self.assertEqual(1, len(warnings)) | 201 self.assertEqual(1, len(warnings)) |
| 202 self.checkWarningWithSingleItem(warnings[0], 'SDK', _SDK_BUILD_FILE, 2) | 202 self.checkWarningWithSingleItem(warnings[0], 'SDK', _SDK_BUILD_FILE, 2) |
| 203 | 203 |
| 204 def testPythonSourceSetInSDKBuildFile(self): | |
| 205 """Tests that a source_set within an SDK buildfile is flagged.""" | |
|
qsr
2014/12/17 12:17:39
Comment seems to be off.
etiennej
2014/12/17 12:19:39
Sorry, fixed.
| |
| 206 mock_input_api = self.inputApiContainingFileWithSourceSets( | |
| 207 _SDK_BUILD_FILE, | |
| 208 [ 'mojo_sdk_source_set(', 'python_binary_source_set(' ]) | |
| 209 warnings = PRESUBMIT._BuildFileChecks(mock_input_api, MockOutputApi()) | |
| 210 | |
| 211 self.assertEqual(0, len(warnings)) | |
| 212 | |
| 204 def testEDKSourceSetInSDKBuildFile(self): | 213 def testEDKSourceSetInSDKBuildFile(self): |
| 205 """Tests that a mojo_edk_source_set within an SDK buildfile is flagged.""" | 214 """Tests that a mojo_edk_source_set within an SDK buildfile is flagged.""" |
| 206 mock_input_api = self.inputApiContainingFileWithSourceSets( | 215 mock_input_api = self.inputApiContainingFileWithSourceSets( |
| 207 _SDK_BUILD_FILE, | 216 _SDK_BUILD_FILE, |
| 208 [ 'mojo_sdk_source_set(', 'mojo_edk_source_set(' ]) | 217 [ 'mojo_sdk_source_set(', 'mojo_edk_source_set(' ]) |
| 209 warnings = PRESUBMIT._BuildFileChecks(mock_input_api, MockOutputApi()) | 218 warnings = PRESUBMIT._BuildFileChecks(mock_input_api, MockOutputApi()) |
| 210 | 219 |
| 211 self.assertEqual(1, len(warnings)) | 220 self.assertEqual(1, len(warnings)) |
| 212 self.checkWarningWithSingleItem(warnings[0], 'SDK', _SDK_BUILD_FILE, 2) | 221 self.checkWarningWithSingleItem(warnings[0], 'SDK', _SDK_BUILD_FILE, 2) |
| 213 | 222 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 234 def testIrrelevantBuildFile(self): | 243 def testIrrelevantBuildFile(self): |
| 235 """Tests that a source_set in a non-SDK/EDK buildfile isn't flagged.""" | 244 """Tests that a source_set in a non-SDK/EDK buildfile isn't flagged.""" |
| 236 mock_input_api = self.inputApiContainingFileWithSourceSets( | 245 mock_input_api = self.inputApiContainingFileWithSourceSets( |
| 237 _IRRELEVANT_BUILD_FILE, | 246 _IRRELEVANT_BUILD_FILE, |
| 238 [ 'source_set(' ]) | 247 [ 'source_set(' ]) |
| 239 warnings = PRESUBMIT._BuildFileChecks(mock_input_api, MockOutputApi()) | 248 warnings = PRESUBMIT._BuildFileChecks(mock_input_api, MockOutputApi()) |
| 240 self.assertEqual(0, len(warnings)) | 249 self.assertEqual(0, len(warnings)) |
| 241 | 250 |
| 242 if __name__ == '__main__': | 251 if __name__ == '__main__': |
| 243 unittest.main() | 252 unittest.main() |
| OLD | NEW |