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

Side by Side Diff: grit/node/misc_unittest.py

Issue 68163013: Properly substitute variables that reference paths outside SRCDIR. (Closed) Base URL: https://grit-i18n.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « grit/node/misc.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 misc.GritNode''' 6 '''Unit tests for misc.GritNode'''
7 7
8 8
9 import os 9 import os
10 import sys 10 import sys
(...skipping 28 matching lines...) Expand all
39 test_resource_ids, 39 test_resource_ids,
40 { 40 {
41 'FOO': os.path.join(base_dir, 'bar'), 41 'FOO': os.path.join(base_dir, 'bar'),
42 'SHARED_INTERMEDIATE_DIR': os.path.join(base_dir, 42 'SHARED_INTERMEDIATE_DIR': os.path.join(base_dir,
43 'out/Release/obj/gen'), 43 'out/Release/obj/gen'),
44 }) 44 })
45 self.assertEqual({}, id_dict.get('bar/file.grd', None)) 45 self.assertEqual({}, id_dict.get('bar/file.grd', None))
46 self.assertEqual({}, 46 self.assertEqual({},
47 id_dict.get('out/Release/obj/gen/devtools/devtools.grd', None)) 47 id_dict.get('out/Release/obj/gen/devtools/devtools.grd', None))
48 48
49 src_dir, id_dict = misc._ReadFirstIdsFromFile(
50 test_resource_ids,
51 {
52 'SHARED_INTERMEDIATE_DIR': '/outside/src_dir',
53 })
54 self.assertEqual({}, id_dict.get('devtools.grd', None))
49 55
50 class IfNodeUnittest(unittest.TestCase): 56 class IfNodeUnittest(unittest.TestCase):
51 def testIffyness(self): 57 def testIffyness(self):
52 grd = grd_reader.Parse(StringIO.StringIO(''' 58 grd = grd_reader.Parse(StringIO.StringIO('''
53 <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir="."> 59 <grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
54 <release seq="3"> 60 <release seq="3">
55 <messages> 61 <messages>
56 <if expr="'bingo' in defs"> 62 <if expr="'bingo' in defs">
57 <message name="IDS_BINGO"> 63 <message name="IDS_BINGO">
58 Bingo! 64 Bingo!
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 # a pseudo language should fail, but they do not fail and the test was 416 # a pseudo language should fail, but they do not fail and the test was
411 # broken and failed to catch it. Fix this. 417 # broken and failed to catch it. Fix this.
412 418
413 # Should not raise an exception since pseudo is allowed 419 # Should not raise an exception since pseudo is allowed
414 rc.FormatMessage(bingo, 'xyz-pseudo') 420 rc.FormatMessage(bingo, 'xyz-pseudo')
415 rc.FormatStructure(menu, 'xyz-pseudo', '.') 421 rc.FormatStructure(menu, 'xyz-pseudo', '.')
416 422
417 423
418 if __name__ == '__main__': 424 if __name__ == '__main__':
419 unittest.main() 425 unittest.main()
OLDNEW
« no previous file with comments | « grit/node/misc.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698