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. |
(...skipping 11 matching lines...) Expand all Loading... |
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 import unittest |
26 | 26 |
27 import xcodeproj | 27 import xcodeproj |
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 |
32 def __init__(self, handler): | 33 def __init__(self, handler): |
33 self.handler = handler | 34 self.handler = handler |
34 | 35 |
35 def turn_off_line_filtering(self): | 36 def turn_off_line_filtering(self): |
36 pass | 37 pass |
37 | 38 |
38 def __call__(self, line_number, category, confidence, message): | 39 def __call__(self, line_number, category, confidence, message): |
39 self.handler(self, line_number, category, confidence, message) | 40 self.handler(self, line_number, category, confidence, message) |
40 return True | 41 return True |
41 | 42 |
(...skipping 18 matching lines...) Expand all Loading... |
60 error_handler = TestErrorHandler(handler) | 61 error_handler = TestErrorHandler(handler) |
61 checker = xcodeproj.XcodeProjectFileChecker('', error_handler) | 62 checker = xcodeproj.XcodeProjectFileChecker('', error_handler) |
62 checker.check(lines) | 63 checker.check(lines) |
63 self.assertTrue(self.had_error, '%s should have error: %s.' % (lines, ex
pected_message)) | 64 self.assertTrue(self.had_error, '%s should have error: %s.' % (lines, ex
pected_message)) |
64 | 65 |
65 def test_detect_development_region(self): | 66 def test_detect_development_region(self): |
66 self.assert_no_error(['developmentRegion = English;']) | 67 self.assert_no_error(['developmentRegion = English;']) |
67 self.assert_error([''], 'Missing "developmentRegion = English".') | 68 self.assert_error([''], 'Missing "developmentRegion = English".') |
68 self.assert_error(['developmentRegion = Japanese;'], | 69 self.assert_error(['developmentRegion = Japanese;'], |
69 'developmentRegion is not English.') | 70 'developmentRegion is not English.') |
OLD | NEW |