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

Unified Diff: grit/tool/build_unittest.py

Issue 407693002: Fix .d file outputs, add support for asserting outputs. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: now with tests 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
« grit/tool/build.py ('K') | « grit/tool/build.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/tool/build_unittest.py
diff --git a/grit/tool/build_unittest.py b/grit/tool/build_unittest.py
index fd640f7c58975496b456486609799f4ce1cb87b7..debe4d4c5312c043a29fd6cb8d2818354c26db8a 100644
--- a/grit/tool/build_unittest.py
+++ b/grit/tool/build_unittest.py
@@ -49,15 +49,41 @@ class BuildUnittest(unittest.TestCase):
self.failUnless(os.path.isfile(expected_dep_file))
with open(expected_dep_file) as f:
line = f.readline()
- (dep_file_name, deps_string) = line.split(': ')
+ (dep_output_file, deps_string) = line.split(': ')
deps = deps_string.split(' ')
- self.failUnlessEqual(os.path.abspath(expected_dep_file),
- os.path.abspath(os.path.join(output_dir, dep_file_name)),
- "depfile should refer to itself as the depended upon file")
+
+ self.failUnlessEqual("resource.h", dep_output_file)
self.failUnlessEqual(1, len(deps))
self.failUnlessEqual(deps[0],
util.PathFromRoot('grit/testdata/substitute.xmb'))
+ def testAssertOutputs(self):
+ output_dir = tempfile.mkdtemp()
+ class DummyOpts(object):
+ def __init__(self):
+ self.input = util.PathFromRoot('grit/testdata/substitute.grd')
+ self.verbose = False
+ self.extra_verbose = False
+
+ # Incomplete output file list should fail.
+ builder_fail = build.RcBuilder()
+ self.failUnlessEqual(2,
+ builder_fail.Run(DummyOpts(), [
+ '-o', output_dir,
+ '-a', os.path.abspath(
+ os.path.join(output_dir, 'en_generated_resources.rc'))]))
+
+ # Complete output file list should succeed.
+ builder_ok = build.RcBuilder()
+ self.failUnlessEqual(0,
+ builder_ok.Run(DummyOpts(), [
+ '-o', output_dir,
+ '-a', os.path.abspath(
+ os.path.join(output_dir, 'en_generated_resources.rc')),
+ '-a', os.path.abspath(
+ os.path.join(output_dir, 'sv_generated_resources.rc')),
+ '-a', os.path.abspath(
+ os.path.join(output_dir, 'resource.h'))]))
if __name__ == '__main__':
unittest.main()
« grit/tool/build.py ('K') | « grit/tool/build.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698