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

Unified Diff: tools/grit/grit/tool/build_unittest.py

Issue 2802853003: Fix assert in grit script by always resolving template vars. (Closed)
Patch Set: style nit Created 3 years, 8 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 | « tools/grit/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: tools/grit/grit/tool/build_unittest.py
diff --git a/tools/grit/grit/tool/build_unittest.py b/tools/grit/grit/tool/build_unittest.py
index 952eff9a4ed6c00a64a3f1ba9b5f72fe6e4a9f5c..1750bfca8eae451fbaf3ce0f0ad0f07f8218f39b 100755
--- a/tools/grit/grit/tool/build_unittest.py
+++ b/tools/grit/grit/tool/build_unittest.py
@@ -114,6 +114,36 @@ class BuildUnittest(unittest.TestCase):
'-a', os.path.abspath(
os.path.join(output_dir, 'resource.h'))]))
+ def testAssertTemplateOutputs(self):
+ output_dir = tempfile.mkdtemp()
+ class DummyOpts(object):
+ def __init__(self):
+ self.input = util.PathFromRoot('grit/testdata/substitute_tmpl.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,
+ '-E', 'name=foo',
+ '-a', os.path.abspath(
+ os.path.join(output_dir, 'en_foo_resources.rc'))]))
+
+ # Complete output file list should succeed.
+ builder_ok = build.RcBuilder()
+ self.failUnlessEqual(0,
+ builder_ok.Run(DummyOpts(), [
+ '-o', output_dir,
+ '-E', 'name=foo',
+ '-a', os.path.abspath(
+ os.path.join(output_dir, 'en_foo_resources.rc')),
+ '-a', os.path.abspath(
+ os.path.join(output_dir, 'sv_foo_resources.rc')),
+ '-a', os.path.abspath(
+ os.path.join(output_dir, 'resource.h'))]))
+
def _verifyWhitelistedOutput(self,
filename,
whitelisted_ids,
« no previous file with comments | « tools/grit/grit/tool/build.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698