| 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 from ast import literal_eval | 6 from ast import literal_eval |
| 7 import os | 7 import os |
| 8 import tempfile | 8 import tempfile |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 closure_args=_COMMON_CLOSURE_ARGS) | 322 closure_args=_COMMON_CLOSURE_ARGS) |
| 323 self.assertFalse(found_errors, | 323 self.assertFalse(found_errors, |
| 324 msg="Expected success, but got failure\n\nOutput:\n%s\n" % stderr) | 324 msg="Expected success, but got failure\n\nOutput:\n%s\n" % stderr) |
| 325 | 325 |
| 326 expected_output = "'use strict';var testScript=function(){};testScript();\n" | 326 expected_output = "'use strict';var testScript=function(){};testScript();\n" |
| 327 self.assertTrue(os.path.exists(out_map)) | 327 self.assertTrue(os.path.exists(out_map)) |
| 328 self.assertTrue(os.path.exists(out_file)) | 328 self.assertTrue(os.path.exists(out_file)) |
| 329 with open(out_file, "r") as file: | 329 with open(out_file, "r") as file: |
| 330 self.assertEquals(file.read(), expected_output) | 330 self.assertEquals(file.read(), expected_output) |
| 331 | 331 |
| 332 def testExportPath(self): |
| 333 self._runCheckerTestExpectSuccess(self._CR_DEFINE_DEFINITION + |
| 334 "cr.exportPath('a.b.c');"); |
| 335 |
| 336 def testExportPathWithTargets(self): |
| 337 self._runCheckerTestExpectSuccess(self._CR_DEFINE_DEFINITION + |
| 338 "var path = 'a.b.c'; cr.exportPath(path, {}, {});") |
| 339 |
| 340 def testExportPathNoPath(self): |
| 341 self._runCheckerTestExpectError(self._CR_DEFINE_DEFINITION + |
| 342 "cr.exportPath();", |
| 343 "ERROR - cr.exportPath() should have at least 1 argument: path name") |
| 344 |
| 332 | 345 |
| 333 if __name__ == "__main__": | 346 if __name__ == "__main__": |
| 334 unittest.main() | 347 unittest.main() |
| OLD | NEW |