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

Side by Side Diff: grit/tool/build_unittest.py

Issue 25683011: Add the ability to generate a depfile when running grit build. (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: add test, respond to comments Created 7 years, 2 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 unified diff | Download patch
« grit/tool/build.py ('K') | « grit/tool/build.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 '''Unit tests for the 'grit build' tool. 6 '''Unit tests for the 'grit build' tool.
7 ''' 7 '''
8 8
9 import os 9 import os
10 import sys 10 import sys
(...skipping 15 matching lines...) Expand all
26 # another <message>. 26 # another <message>.
27 output_dir = tempfile.mkdtemp() 27 output_dir = tempfile.mkdtemp()
28 builder = build.RcBuilder() 28 builder = build.RcBuilder()
29 class DummyOpts(object): 29 class DummyOpts(object):
30 def __init__(self): 30 def __init__(self):
31 self.input = util.PathFromRoot('grit/testdata/substitute.grd') 31 self.input = util.PathFromRoot('grit/testdata/substitute.grd')
32 self.verbose = False 32 self.verbose = False
33 self.extra_verbose = False 33 self.extra_verbose = False
34 builder.Run(DummyOpts(), ['-o', output_dir]) 34 builder.Run(DummyOpts(), ['-o', output_dir])
35 35
36 def testGenerateDepFile(self):
37 output_dir = tempfile.mkdtemp()
38 builder = build.RcBuilder()
39 class DummyOpts(object):
40 def __init__(self):
41 self.input = util.PathFromRoot('grit/testdata/substitute.grd')
42 self.verbose = False
43 self.extra_verbose = False
44 builder.Run(DummyOpts(), ['-o', output_dir, '--dep-dir', output_dir])
45
46 expected_dep_file = os.path.join(output_dir, 'substitute.grd.d')
47 self.failUnless(os.path.isfile(expected_dep_file))
48 with open(expected_dep_file) as f:
49 line = f.readline()
50 (dep_file_name, deps_string) = line.split(': ')
51 deps = deps_string.split(' ')
52 self.failUnlessEqual(os.path.abspath(expected_dep_file),
53 os.path.abspath(os.path.join(output_dir, dep_file_name)),
54 "depfile should refer to itself as the depended upon file")
55 self.failUnlessEqual(1, len(deps))
56 self.failUnlessEqual(deps[0],
57 util.PathFromRoot('grit/testdata/substitute.xmb'))
58
36 59
37 if __name__ == '__main__': 60 if __name__ == '__main__':
38 unittest.main() 61 unittest.main()
OLDNEW
« 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