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

Side by Side Diff: native_client_sdk/src/build_tools/tests/generate_make_test.py

Issue 11571032: [NaCl SDK] cleanup python unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 | « no previous file | native_client_sdk/src/build_tools/tests/sdktools_commands_test.py » ('j') | 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 import copy 6 import copy
7 import datetime 7 import datetime
8 import os 8 import os
9 import posixpath 9 import posixpath
10 import subprocess 10 import subprocess
(...skipping 12 matching lines...) Expand all
23 { 23 {
24 'NAME' : 'hello_world', 24 'NAME' : 'hello_world',
25 'TYPE' : 'main', 25 'TYPE' : 'main',
26 'SOURCES' : ['hello_world.c'], 26 'SOURCES' : ['hello_world.c'],
27 }, 27 },
28 ], 28 ],
29 'DEST' : 'examples' 29 'DEST' : 'examples'
30 } 30 }
31 31
32 class TestFunctions(unittest.TestCase): 32 class TestFunctions(unittest.TestCase):
33 def testPatsubst(self):
34 val = generate_make.GenPatsubst(32, 'FOO', 'cc', 'CXX')
35 gold = '$(patsubst %.cc,%_32.o,$(FOO_CXX))'
36 self.assertEqual(val, gold)
37
38 def testPatsubst(self):
39 val = generate_make.GenPatsubst(32, 'FOO', 'cc', 'CXX')
40 gold = '$(patsubst %.cc,%_32.o,$(FOO_CXX))'
41 self.assertEqual(val, gold)
42
43 def testSetVar(self): 33 def testSetVar(self):
44 val = generate_make.SetVar('FOO',[]) 34 val = generate_make.SetVar('FOO',[])
45 self.assertEqual(val, 'FOO:=\n') 35 self.assertEqual(val, 'FOO:=\n')
46 36
47 val = generate_make.SetVar('FOO',['BAR']) 37 val = generate_make.SetVar('FOO',['BAR'])
48 self.assertEqual(val, 'FOO:=BAR\n') 38 self.assertEqual(val, 'FOO:=BAR\n')
49 39
50 items = ['FOO_' + 'x' * (i % 13) for i in range(50)] 40 items = ['FOO_' + 'x' * (i % 13) for i in range(50)]
51 for i in range(10): 41 for i in range(10):
52 wrapped = generate_make.SetVar('BAR_' + 'x' * i, items) 42 wrapped = generate_make.SetVar('BAR_' + 'x' * i, items)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 # TODO(noelallen): Add test which generates a real make and runs it. 105 # TODO(noelallen): Add test which generates a real make and runs it.
116 106
117 def main(): 107 def main():
118 suite = unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__]) 108 suite = unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__])
119 result = unittest.TextTestRunner(verbosity=2).run(suite) 109 result = unittest.TextTestRunner(verbosity=2).run(suite)
120 110
121 return int(not result.wasSuccessful()) 111 return int(not result.wasSuccessful())
122 112
123 if __name__ == '__main__': 113 if __name__ == '__main__':
124 sys.exit(main()) 114 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | native_client_sdk/src/build_tools/tests/sdktools_commands_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698