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

Unified Diff: tools/boilerplate.py

Issue 2570093002: Remove test suffixes from included filename in boilerplate.py. (Closed)
Patch Set: Add for loop; add '_browsertest' suffix. 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..b26493e710f27f5d804950ab0ab241e737d6f73b 100755
--- a/tools/boilerplate.py
+++ b/tools/boilerplate.py
@@ -51,15 +51,22 @@ def _CppHeader(filename):
])
-def _CppImplementation(filename):
+def _RemoveTestSuffix(filename):
base, _ = os.path.splitext(filename)
- include = '#include "' + base + '.h"'
+ suffixes = [ '_test', '_unittest', '_browsertest' ]
+ for suffix in suffixes:
+ l = len(suffix)
+ if base[-l:] == suffix:
+ return base[:-l]
+ 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