Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: sky/tools/webkitpy/style/checkers/xcodeproj_unittest.py

Issue 675343003: Prune a bunch of webkitpy. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright (C) 2011 Google Inc. All rights reserved.
2 #
3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions
5 # are met:
6 # 1. Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer.
8 # 2. Redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution.
11 #
12 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
13 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
14 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
15 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
16 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
17 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
18 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
23
24 """Unit test for xcodeproj.py."""
25 import unittest
26
27 import xcodeproj
28
29
30 class TestErrorHandler(object):
31 """Error handler for XcodeProjectFileChecker unittests"""
32 def __init__(self, handler):
33 self.handler = handler
34
35 def turn_off_line_filtering(self):
36 pass
37
38 def __call__(self, line_number, category, confidence, message):
39 self.handler(self, line_number, category, confidence, message)
40 return True
41
42
43 class XcodeProjectFileCheckerTest(unittest.TestCase):
44 """Tests XcodeProjectFileChecker class."""
45
46 def assert_no_error(self, lines):
47 def handler(error_handler, line_number, category, confidence, message):
48 self.fail('Unexpected error: %d %s %d %s' % (line_number, category, confidence, message))
49
50 error_handler = TestErrorHandler(handler)
51 checker = xcodeproj.XcodeProjectFileChecker('', error_handler)
52 checker.check(lines)
53
54 def assert_error(self, lines, expected_message):
55 self.had_error = False
56
57 def handler(error_handler, line_number, category, confidence, message):
58 self.assertEqual(expected_message, message)
59 self.had_error = True
60 error_handler = TestErrorHandler(handler)
61 checker = xcodeproj.XcodeProjectFileChecker('', error_handler)
62 checker.check(lines)
63 self.assertTrue(self.had_error, '%s should have error: %s.' % (lines, ex pected_message))
64
65 def test_detect_development_region(self):
66 self.assert_no_error(['developmentRegion = English;'])
67 self.assert_error([''], 'Missing "developmentRegion = English".')
68 self.assert_error(['developmentRegion = Japanese;'],
69 'developmentRegion is not English.')
OLDNEW
« no previous file with comments | « sky/tools/webkitpy/style/checkers/xcodeproj.py ('k') | sky/tools/webkitpy/style/checkers/xml.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698