| OLD | NEW |
| 1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
| 5 # are met: | 5 # are met: |
| 6 # 1. Redistributions of source code must retain the above copyright | 6 # 1. Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # 2. Redistributions in binary form must reproduce the above copyright | 8 # 2. Redistributions in binary form must reproduce the above copyright |
| 9 # notice, this list of conditions and the following disclaimer in the | 9 # notice, this list of conditions and the following disclaimer in the |
| 10 # documentation and/or other materials provided with the distribution. | 10 # documentation and/or other materials provided with the distribution. |
| 11 # | 11 # |
| 12 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 12 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 13 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 13 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 14 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 14 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 15 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 15 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 16 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 16 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 17 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 17 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 18 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 18 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 19 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 19 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 20 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 21 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 21 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 22 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 23 | 23 |
| 24 """Unit test for xcodeproj.py.""" | 24 """Unit test for xcodeproj.py.""" |
| 25 |
| 25 import unittest | 26 import unittest |
| 26 | 27 |
| 27 import xcodeproj | 28 from webkitpy.style.checkers import xcodeproj |
| 28 | 29 |
| 29 | 30 |
| 30 class TestErrorHandler(object): | 31 class TestErrorHandler(object): |
| 31 """Error handler for XcodeProjectFileChecker unittests""" | 32 """Error handler for XcodeProjectFileChecker unittests""" |
| 32 | 33 |
| 33 def __init__(self, handler): | 34 def __init__(self, handler): |
| 34 self.handler = handler | 35 self.handler = handler |
| 35 | 36 |
| 36 def turn_off_line_filtering(self): | 37 def turn_off_line_filtering(self): |
| 37 pass | 38 pass |
| (...skipping 23 matching lines...) Expand all Loading... |
| 61 error_handler = TestErrorHandler(handler) | 62 error_handler = TestErrorHandler(handler) |
| 62 checker = xcodeproj.XcodeProjectFileChecker('', error_handler) | 63 checker = xcodeproj.XcodeProjectFileChecker('', error_handler) |
| 63 checker.check(lines) | 64 checker.check(lines) |
| 64 self.assertTrue(self.had_error, '%s should have error: %s.' % (lines, ex
pected_message)) | 65 self.assertTrue(self.had_error, '%s should have error: %s.' % (lines, ex
pected_message)) |
| 65 | 66 |
| 66 def test_detect_development_region(self): | 67 def test_detect_development_region(self): |
| 67 self.assert_no_error(['developmentRegion = English;']) | 68 self.assert_no_error(['developmentRegion = English;']) |
| 68 self.assert_error([''], 'Missing "developmentRegion = English".') | 69 self.assert_error([''], 'Missing "developmentRegion = English".') |
| 69 self.assert_error(['developmentRegion = Japanese;'], | 70 self.assert_error(['developmentRegion = Japanese;'], |
| 70 'developmentRegion is not English.') | 71 'developmentRegion is not English.') |
| OLD | NEW |