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

Unified Diff: Tools/Scripts/webkitpy/layout_tests/port/base.py

Issue 423073004: Fix diff generation by difflib to report missing end of file newlines. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Tools/Scripts/webkitpy/layout_tests/port/base.py
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/base.py b/Tools/Scripts/webkitpy/layout_tests/port/base.py
index ab4f31acfa96af84e8ec202d247abb9a60805545..2f27e8ebb0efeba0dcf73e96902dd2e19f7aa83a 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/base.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/base.py
@@ -526,7 +526,17 @@ class Port(object):
actual_text.splitlines(True),
expected_filename,
actual_filename)
- return ''.join(diff)
+
+ # The diff generated by the difflib is incorrect if one of the files
+ # does not have a newline at the end of the file and it is present in
+ # the diff. Relevant Python issue: http://bugs.python.org/issue2142
+ def diff_fixup(diff):
+ for line in diff:
+ yield line
+ if not line.endswith('\n'):
+ yield '\n\ No newline at end of file\n'
+
+ return ''.join(diff_fixup(diff))
def driver_name(self):
if self.get_option('driver_name'):
« no previous file with comments | « no previous file | Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698