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

Unified Diff: checkdeps/checkdeps_test.py

Issue 2653023004: Dependancy check for .proto files is added. (Closed)
Patch Set: Proto depscheck ignores partial paths. Created 3 years, 10 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 | « checkdeps/checkdeps.py ('k') | checkdeps/proto_checker.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: checkdeps/checkdeps_test.py
diff --git a/checkdeps/checkdeps_test.py b/checkdeps/checkdeps_test.py
index 760668ce800e8210e26f5faa379712d14d589572..5b5b03f85692a05112fa259818a5a2478452caf1 100755
--- a/checkdeps/checkdeps_test.py
+++ b/checkdeps/checkdeps_test.py
@@ -198,6 +198,42 @@ class CheckDepsTest(unittest.TestCase):
dirs_traversed.append(dir_names.pop())
self.failUnlessEqual(dirs_traversed, sorted(dirs_traversed))
+ def testCheckPartialImportsAreAllowed(self):
+ problems = self.deps_checker.CheckAddedProtoImports(
+ [['checkdeps/testdata/test.proto',
+ ['import "no_rule_for_this/nogood.proto"']
+ ]])
+ self.failIf(problems)
+
+ def testCheckAddedFullPathImportsAllowed(self):
+ # NOTE: Base directory is buildtools.
+ problems = self.deps_checker.CheckAddedProtoImports(
+ [['checkdeps/testdata/test.proto',
+ ['import "checkdeps/testdata/allowed/good.proto"',
+ 'import "checkdeps/testdata/disallowed/sub_folder/good.proto"']
+ ]])
+ self.failIf(problems)
+
+ def testCheckAddedFullPathImportsDisallowed(self):
+ problems = self.deps_checker.CheckAddedProtoImports(
+ [['checkdeps/testdata/test.proto',
+ ['import "checkdeps/testdata/disallowed/bad.proto"']
+ ]])
+ self.failUnless(problems)
+
+ def testCheckAddedFullPathImportsManyGarbageLines(self):
+ garbage_lines = ["My name is Sam%d\n" % num for num in range(50)]
+ problems = self.deps_checker.CheckAddedProtoImports(
+ [['checkdeps/testdata/test.proto',
+ garbage_lines]])
+ self.failIf(problems)
+
+ def testCheckAddedIncludesNoRuleFullPath(self):
+ problems = self.deps_checker.CheckAddedProtoImports(
+ [['checkdeps/testdata/test.proto',
+ ['import "../tools/some.proto"']
+ ]])
+ self.failUnless(problems)
if __name__ == '__main__':
unittest.main()
« no previous file with comments | « checkdeps/checkdeps.py ('k') | checkdeps/proto_checker.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698