OLD | NEW |
1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) | 1 # Copyright (C) 2010 Chris Jerdonek (cjerdonek@webkit.org) |
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 APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY | 12 # THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY |
13 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 13 # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
14 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 14 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
15 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY | 15 # DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
16 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 16 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
17 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 17 # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
18 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | 18 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
19 # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 19 # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
20 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 20 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
21 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 21 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
22 | 22 |
23 """Unit tests for common.py.""" | 23 """Unit tests for common.py.""" |
24 | 24 |
25 import webkitpy.thirdparty.unittest2 as unittest | 25 import unittest |
26 | 26 |
27 from common import CarriageReturnChecker | 27 from common import CarriageReturnChecker |
28 from common import TabChecker | 28 from common import TabChecker |
29 | 29 |
30 # FIXME: The unit tests for the cpp, text, and common checkers should | 30 # FIXME: The unit tests for the cpp, text, and common checkers should |
31 # share supporting test code. This can include, for example, the | 31 # share supporting test code. This can include, for example, the |
32 # mock style error handling code and the code to check that all | 32 # mock style error handling code and the code to check that all |
33 # of a checker's categories are covered by the unit tests. | 33 # of a checker's categories are covered by the unit tests. |
34 # Such shared code can be located in a shared test file, perhaps | 34 # Such shared code can be located in a shared test file, perhaps |
35 # even this file. | 35 # even this file. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 checker.check(input_lines) | 112 checker.check(input_lines) |
113 self.assertEqual(self._error_lines, error_lines) | 113 self.assertEqual(self._error_lines, error_lines) |
114 | 114 |
115 def test_notab(self): | 115 def test_notab(self): |
116 self.assert_tab([''], []) | 116 self.assert_tab([''], []) |
117 self.assert_tab(['foo', 'bar'], []) | 117 self.assert_tab(['foo', 'bar'], []) |
118 | 118 |
119 def test_tab(self): | 119 def test_tab(self): |
120 self.assert_tab(['\tfoo'], [1]) | 120 self.assert_tab(['\tfoo'], [1]) |
121 self.assert_tab(['line1', '\tline2', 'line3\t'], [2, 3]) | 121 self.assert_tab(['line1', '\tline2', 'line3\t'], [2, 3]) |
OLD | NEW |