Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Unit tests for Web Development Style Guide checker.""" | 6 """Unit tests for Web Development Style Guide checker.""" |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import re | 9 import re |
| 10 import sys | 10 import sys |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 """Checks that the |checker| flags |line| as a style error.""" | 42 """Checks that the |checker| flags |line| as a style error.""" |
| 43 error = checker(1, line) | 43 error = checker(1, line) |
| 44 self.assertNotEqual('', error, 'Should be flagged as style error: ' + line) | 44 self.assertNotEqual('', error, 'Should be flagged as style error: ' + line) |
| 45 highlight = GetHighlight(line, error).strip() | 45 highlight = GetHighlight(line, error).strip() |
| 46 | 46 |
| 47 def ShouldPassCheck(self, line, checker): | 47 def ShouldPassCheck(self, line, checker): |
| 48 """Checks that the |checker| doesn't flag |line| as a style error.""" | 48 """Checks that the |checker| doesn't flag |line| as a style error.""" |
| 49 error = checker(1, line) | 49 error = checker(1, line) |
| 50 self.assertEqual('', error, 'Should not be flagged as style error: ' + line) | 50 self.assertEqual('', error, 'Should not be flagged as style error: ' + line) |
| 51 | 51 |
| 52 def testTemplateExpressionRemoval(self): | |
| 53 lines = [ | |
| 54 '${tag}', | |
| 55 '$${}', | |
| 56 '<hr class="${tag}">', | |
| 57 ] | |
| 58 for line in lines: | |
| 59 self.ShouldPassCheck(line, self.checker.ClassesUseDashFormCheck) | |
|
Dan Beam
2015/07/14 21:23:40
why are you running this specific check?
Dan Beam
2015/07/15 18:56:41
ping
dschuyler
2015/07/16 02:08:42
The code is removed now.
| |
| 60 | |
| 52 def testClassesUseDashFormCheckFails(self): | 61 def testClassesUseDashFormCheckFails(self): |
| 53 lines = [ | 62 lines = [ |
| 54 ' <a class="Foo-bar" href="classBar"> ', | 63 ' <a class="Foo-bar" href="classBar"> ', |
| 55 '<b class="foo-Bar"> ', | 64 '<b class="foo-Bar"> ', |
| 56 '<i class="foo_bar" >', | 65 '<i class="foo_bar" >', |
| 57 ' <hr class="fooBar"> ', | 66 ' <hr class="fooBar"> ', |
| 58 ] | 67 ] |
| 59 for line in lines: | 68 for line in lines: |
| 60 self.ShouldFailCheck(line, self.checker.ClassesUseDashFormCheck) | 69 self.ShouldFailCheck(line, self.checker.ClassesUseDashFormCheck) |
| 61 | 70 |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 982 opacity: .0; | 991 opacity: .0; |
| 983 opacity: 0.0; | 992 opacity: 0.0; |
| 984 opacity: 0.; | 993 opacity: 0.; |
| 985 border-width: 0mm; | 994 border-width: 0mm; |
| 986 height: 0cm; | 995 height: 0cm; |
| 987 width: 0in; | 996 width: 0in; |
| 988 """) | 997 """) |
| 989 | 998 |
| 990 if __name__ == '__main__': | 999 if __name__ == '__main__': |
| 991 unittest.main() | 1000 unittest.main() |
| OLD | NEW |