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

Side by Side Diff: chrome/browser/web_dev_style/html_checker_test.py

Issue 1256653002: Fix i18n-content HTML presubmit check (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months 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
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
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()
OLDNEW
« chrome/browser/web_dev_style/html_checker.py ('K') | « chrome/browser/web_dev_style/html_checker.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698