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

Unified Diff: tools/boilerplate.py

Issue 2570093002: Remove test suffixes from included filename in boilerplate.py. (Closed)
Patch Set: Created 4 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/boilerplate.py
diff --git a/tools/boilerplate.py b/tools/boilerplate.py
index 74a2a4d10e13413e0a32d180bce534214d9a614c..d6f0973c2266b540c435d532a4667cde6b2af6f5 100755
--- a/tools/boilerplate.py
+++ b/tools/boilerplate.py
@@ -51,15 +51,21 @@ def _CppHeader(filename):
])
-def _CppImplementation(filename):
+def _RemoveTestSuffix(filename):
base, _ = os.path.splitext(filename)
- include = '#include "' + base + '.h"'
+ if base[-5:] == '_test':
Robert Sesek 2016/12/13 17:23:20 It may be easier to maintain something like this:
Bence 2016/12/14 12:02:19 Done.
+ return base[:-5]
+ if base[-9:] == '_unittest':
+ return base[:-9]
+ return base
+
+def _CppImplementation(filename):
+ include = '#include "' + _RemoveTestSuffix(filename) + '.h"'
return '\n'.join(['', include])
def _ObjCppImplementation(filename):
- base, _ = os.path.splitext(filename)
- include = '#import "' + base + '.h"'
+ include = '#import "' + _RemoveTestSuffix(filename) + '.h"'
return '\n'.join(['', include])
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698