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 python_binary_source_set within an SDK buildfile is |
| 206 accepted.""" |
| 207 mock_input_api = self.inputApiContainingFileWithSourceSets( |
| 208 _SDK_BUILD_FILE, |
| 209 [ 'mojo_sdk_source_set(', 'python_binary_source_set(' ]) |
| 210 warnings = PRESUBMIT._BuildFileChecks(mock_input_api, MockOutputApi()) |
| 211 |
| 212 self.assertEqual(0, len(warnings)) |
| 213 |
204 def testEDKSourceSetInSDKBuildFile(self): | 214 def testEDKSourceSetInSDKBuildFile(self): |
205 """Tests that a mojo_edk_source_set within an SDK buildfile is flagged.""" | 215 """Tests that a mojo_edk_source_set within an SDK buildfile is flagged.""" |
206 mock_input_api = self.inputApiContainingFileWithSourceSets( | 216 mock_input_api = self.inputApiContainingFileWithSourceSets( |
207 _SDK_BUILD_FILE, | 217 _SDK_BUILD_FILE, |
208 [ 'mojo_sdk_source_set(', 'mojo_edk_source_set(' ]) | 218 [ 'mojo_sdk_source_set(', 'mojo_edk_source_set(' ]) |
209 warnings = PRESUBMIT._BuildFileChecks(mock_input_api, MockOutputApi()) | 219 warnings = PRESUBMIT._BuildFileChecks(mock_input_api, MockOutputApi()) |
210 | 220 |
211 self.assertEqual(1, len(warnings)) | 221 self.assertEqual(1, len(warnings)) |
212 self.checkWarningWithSingleItem(warnings[0], 'SDK', _SDK_BUILD_FILE, 2) | 222 self.checkWarningWithSingleItem(warnings[0], 'SDK', _SDK_BUILD_FILE, 2) |
213 | 223 |
(...skipping 20 matching lines...) Expand all Loading... |
234 def testIrrelevantBuildFile(self): | 244 def testIrrelevantBuildFile(self): |
235 """Tests that a source_set in a non-SDK/EDK buildfile isn't flagged.""" | 245 """Tests that a source_set in a non-SDK/EDK buildfile isn't flagged.""" |
236 mock_input_api = self.inputApiContainingFileWithSourceSets( | 246 mock_input_api = self.inputApiContainingFileWithSourceSets( |
237 _IRRELEVANT_BUILD_FILE, | 247 _IRRELEVANT_BUILD_FILE, |
238 [ 'source_set(' ]) | 248 [ 'source_set(' ]) |
239 warnings = PRESUBMIT._BuildFileChecks(mock_input_api, MockOutputApi()) | 249 warnings = PRESUBMIT._BuildFileChecks(mock_input_api, MockOutputApi()) |
240 self.assertEqual(0, len(warnings)) | 250 self.assertEqual(0, len(warnings)) |
241 | 251 |
242 if __name__ == '__main__': | 252 if __name__ == '__main__': |
243 unittest.main() | 253 unittest.main() |
OLD | NEW |