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 import unittest |
25 | 26 |
26 import xcodeproj | 27 import xcodeproj |
27 import webkitpy.thirdparty.unittest2 as unittest | |
28 | 28 |
29 | 29 |
30 class TestErrorHandler(object): | 30 class TestErrorHandler(object): |
31 """Error handler for XcodeProjectFileChecker unittests""" | 31 """Error handler for XcodeProjectFileChecker unittests""" |
32 def __init__(self, handler): | 32 def __init__(self, handler): |
33 self.handler = handler | 33 self.handler = handler |
34 | 34 |
35 def turn_off_line_filtering(self): | 35 def turn_off_line_filtering(self): |
36 pass | 36 pass |
37 | 37 |
(...skipping 22 matching lines...) Expand all Loading... |
60 error_handler = TestErrorHandler(handler) | 60 error_handler = TestErrorHandler(handler) |
61 checker = xcodeproj.XcodeProjectFileChecker('', error_handler) | 61 checker = xcodeproj.XcodeProjectFileChecker('', error_handler) |
62 checker.check(lines) | 62 checker.check(lines) |
63 self.assertTrue(self.had_error, '%s should have error: %s.' % (lines, ex
pected_message)) | 63 self.assertTrue(self.had_error, '%s should have error: %s.' % (lines, ex
pected_message)) |
64 | 64 |
65 def test_detect_development_region(self): | 65 def test_detect_development_region(self): |
66 self.assert_no_error(['developmentRegion = English;']) | 66 self.assert_no_error(['developmentRegion = English;']) |
67 self.assert_error([''], 'Missing "developmentRegion = English".') | 67 self.assert_error([''], 'Missing "developmentRegion = English".') |
68 self.assert_error(['developmentRegion = Japanese;'], | 68 self.assert_error(['developmentRegion = Japanese;'], |
69 'developmentRegion is not English.') | 69 'developmentRegion is not English.') |
OLD | NEW |