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

Side by Side Diff: tools/web_dev_style/test_util.py

Issue 2890513003: Move chrome/browser/web_dev_style/ to tools/ to use from more places (Closed)
Patch Set: tsergeant@ review Created 3 years, 7 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
« no previous file with comments | « tools/web_dev_style/resource_checker_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 def GetHighlight(line, error): 6 def GetHighlight(line, error):
7 """Returns the substring of |line| that is highlighted in |error|.""" 7 """Returns the substring of |line| that is highlighted in |error|."""
8 error_lines = error.split('\n') 8 error_lines = error.split('\n')
9 # TODO(dschuyler): Splitting the error on \n will prevent index(line) 9 # TODO(dschuyler): Splitting the error on \n will prevent index(line)
10 # from finding the line. As a workaround, return the whole, unfiltered 10 # from finding the line. As a workaround, return the whole, unfiltered
11 # line. 11 # line.
12 if line not in error_lines: 12 if line not in error_lines:
13 return line 13 return line
14 highlight = error_lines[error_lines.index(line) + 1] 14 highlight = error_lines[error_lines.index(line) + 1]
15 return ''.join(ch1 for (ch1, ch2) in zip(line, highlight) if ch2 == '^') 15 return ''.join(ch1 for (ch1, ch2) in zip(line, highlight) if ch2 == '^')
OLDNEW
« no previous file with comments | « tools/web_dev_style/resource_checker_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698