| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 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 import html_checker | 6 import html_checker |
| 7 from os import path as os_path | 7 from os import path as os_path |
| 8 import re | 8 import re |
| 9 from sys import path as sys_path | 9 from sys import path as sys_path |
| 10 import test_util | 10 import test_util |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 'i18n-content="foo-"', | 133 'i18n-content="foo-"', |
| 134 'i18n-content="Foo"', | 134 'i18n-content="Foo"', |
| 135 ] | 135 ] |
| 136 for line in lines: | 136 for line in lines: |
| 137 self.ShouldFailCheck(line, self.checker.I18nContentJavaScriptCaseCheck) | 137 self.ShouldFailCheck(line, self.checker.I18nContentJavaScriptCaseCheck) |
| 138 | 138 |
| 139 def testI18nContentJavaScriptCaseCheckPasses(self): | 139 def testI18nContentJavaScriptCaseCheckPasses(self): |
| 140 lines = [ | 140 lines = [ |
| 141 ' i18n-content="abc" ', | 141 ' i18n-content="abc" ', |
| 142 'i18n-content="fooBar"', | 142 'i18n-content="fooBar"', |
| 143 'i18n-content="validName" attr="invalidName_"', |
| 143 '<div i18n-content="exampleTitle"', | 144 '<div i18n-content="exampleTitle"', |
| 144 ] | 145 ] |
| 145 for line in lines: | 146 for line in lines: |
| 146 self.ShouldPassCheck(line, self.checker.I18nContentJavaScriptCaseCheck) | 147 self.ShouldPassCheck(line, self.checker.I18nContentJavaScriptCaseCheck) |
| 147 | 148 |
| 148 def testLabelCheckFails(self): | 149 def testLabelCheckFails(self): |
| 149 lines = [ | 150 lines = [ |
| 150 ' for="abc"', | 151 ' for="abc"', |
| 151 "for= ", | 152 "for= ", |
| 152 " \tfor= ", | 153 " \tfor= ", |
| 153 " for=" | 154 " for=" |
| 154 ] | 155 ] |
| 155 for line in lines: | 156 for line in lines: |
| 156 self.ShouldFailCheck(line, self.checker.LabelCheck) | 157 self.ShouldFailCheck(line, self.checker.LabelCheck) |
| 157 | 158 |
| 158 def testLabelCheckPass(self): | 159 def testLabelCheckPass(self): |
| 159 lines = [ | 160 lines = [ |
| 160 ' my-for="abc" ', | 161 ' my-for="abc" ', |
| 161 ' myfor="abc" ', | 162 ' myfor="abc" ', |
| 162 " <for", | 163 " <for", |
| 163 ] | 164 ] |
| 164 for line in lines: | 165 for line in lines: |
| 165 self.ShouldPassCheck(line, self.checker.LabelCheck) | 166 self.ShouldPassCheck(line, self.checker.LabelCheck) |
| 166 | 167 |
| 167 | 168 |
| 168 if __name__ == '__main__': | 169 if __name__ == '__main__': |
| 169 unittest.main() | 170 unittest.main() |
| OLD | NEW |