1#!/usr/bin/env python 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 4# found in the LICENSE file. 5 6'''Unit tests for the 'grit build' tool. 7''' 8 9import os 10import sys 11import tempfile 12if __name__ == '__main__': 13 sys.path.append(os.path.join(os.path.dirname(__file__), '../..')) 14 15import unittest 16 17from grit import util 18from grit.tool import build 19 20 21class BuildUnittest(unittest.TestCase): 22 23 def testFindTranslationsWithSubstitutions(self): 24 # This is a regression test; we had a bug where GRIT would fail to find 25 # messages with substitutions e.g. "Hello [IDS_USER]" where IDS_USER is 26 # another <message>. 27 output_dir = tempfile.mkdtemp() 28 builder = build.RcBuilder() 29 class DummyOpts(object): 30 def __init__(self): 31 self.input = util.PathFromRoot('grit/testdata/substitute.grd') 32 self.verbose = False 33 self.extra_verbose = False 34 builder.Run(DummyOpts(), ['-o', output_dir]) 35 36 37if __name__ == '__main__': 38 unittest.main() 39