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

Unified Diff: PRESUBMIT_unittest.py

Issue 43017: Add end of file newline checks to PRESUBMIT.py. (Closed)
Patch Set: Only check for \n if the file isn't empty. Created 11 years, 9 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 | « PRESUBMIT.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT_unittest.py
diff --git a/PRESUBMIT_unittest.py b/PRESUBMIT_unittest.py
index b8183c25ea32a0562ae04d4f50cb2e3ebe937e7c..6f2ff00b2d60dfee7619ea5f52b868703fbd5e1c 100755
--- a/PRESUBMIT_unittest.py
+++ b/PRESUBMIT_unittest.py
@@ -62,24 +62,24 @@ class PresubmitUnittest(unittest.TestCase):
MockAffectedFile('foo/blat/source.py'),
]
self.file_contents = 'file with \n\terror\nhere\r\nyes there'
- # 3 source files, 2 errors by file + 1 global CR error.
- self.failUnless(len(PRESUBMIT.LocalChecks(api, MockOutputApi)) == 7)
+ # 3 source files, 2 errors by file + 1 global CR + 1 global EOF error.
+ self.failUnless(len(PRESUBMIT.LocalChecks(api, MockOutputApi)) == 8)
- self.file_contents = 'file\twith\ttabs'
+ self.file_contents = 'file\twith\ttabs\n'
# 3 source files, 1 error by file.
self.failUnless(len(PRESUBMIT.LocalChecks(api, MockOutputApi)) == 3)
- self.file_contents = 'file\rusing\rCRs'
+ self.file_contents = 'file\rusing\rCRs\n'
# One global CR error.
self.failUnless(len(PRESUBMIT.LocalChecks(api, MockOutputApi)) == 1)
self.failUnless(
len(PRESUBMIT.LocalChecks(api, MockOutputApi)[0].items) == 3)
- self.file_contents = 'both\ttabs and\r\nCRLF'
+ self.file_contents = 'both\ttabs and\r\nCRLF\n'
# 3 source files, 1 error by file + 1 global CR error.
self.failUnless(len(PRESUBMIT.LocalChecks(api, MockOutputApi)) == 4)
- self.file_contents = 'file with\nzero \\t errors \\r\\n'
+ self.file_contents = 'file with\nzero \\t errors \\r\\n\n'
self.failIf(PRESUBMIT.LocalChecks(api, MockOutputApi))
« no previous file with comments | « PRESUBMIT.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698