OLD | NEW |
| (Empty) |
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 grit.py''' | |
7 | |
8 import os | |
9 import sys | |
10 if __name__ == '__main__': | |
11 sys.path.append(os.path.join(os.path.dirname(__file__), '..')) | |
12 | |
13 import unittest | |
14 import StringIO | |
15 | |
16 from grit import util | |
17 import grit.grit_runner | |
18 | |
19 class OptionArgsUnittest(unittest.TestCase): | |
20 def setUp(self): | |
21 self.buf = StringIO.StringIO() | |
22 self.old_stdout = sys.stdout | |
23 sys.stdout = self.buf | |
24 | |
25 def tearDown(self): | |
26 sys.stdout = self.old_stdout | |
27 | |
28 def testSimple(self): | |
29 grit.grit_runner.Main(['-i', | |
30 util.PathFromRoot('grit/testdata/simple-input.xml'), | |
31 '-d', 'test', 'bla', 'voff', 'ga']) | |
32 output = self.buf.getvalue() | |
33 self.failUnless(output.count('disconnected')) | |
34 self.failUnless(output.count("'test'") == 0) # tool name doesn't occur | |
35 self.failUnless(output.count('bla')) | |
36 self.failUnless(output.count('simple-input.xml')) | |
37 | |
38 | |
39 if __name__ == '__main__': | |
40 unittest.main() | |
OLD | NEW |