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

Side by Side Diff: tests/gclient_utils_test.py

Issue 3473003: Add automated sys.stdout check. (Closed)
Patch Set: Created 10 years, 3 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
« no previous file with comments | « tests/gclient_scm_test.py ('k') | tests/super_mox.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/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 StringIO 6 import StringIO
7 7
8 # Fixes include path. 8 # Fixes include path.
9 from super_mox import SuperMoxTestBase 9 from super_mox import SuperMoxTestBase
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 capture_list.append(match.group(1)) 103 capture_list.append(match.group(1))
104 gclient_utils.CheckCallAndFilterAndHeader( 104 gclient_utils.CheckCallAndFilterAndHeader(
105 args, cwd=cwd, always=True, filter_fn=FilterLines) 105 args, cwd=cwd, always=True, filter_fn=FilterLines)
106 self.assertEquals(line_list, ['ahah', 'accb', 'allo', 'addb']) 106 self.assertEquals(line_list, ['ahah', 'accb', 'allo', 'addb'])
107 self.assertEquals(capture_list, ['cc', 'dd']) 107 self.assertEquals(capture_list, ['cc', 'dd'])
108 108
109 def testCheckCallAndFilter(self): 109 def testCheckCallAndFilter(self):
110 args = ['boo', 'foo', 'bar'] 110 args = ['boo', 'foo', 'bar']
111 test_string = 'ahah\naccb\nallo\naddb\n' 111 test_string = 'ahah\naccb\nallo\naddb\n'
112 self._inner(args, test_string) 112 self._inner(args, test_string)
113 self.checkstdout('\n________ running \'boo foo bar\' in \'bleh\'\n'
114 'ahah\naccb\nallo\naddb\n\n'
115 '________ running \'boo foo bar\' in \'bleh\'\nahah\naccb\nallo\naddb\n' )
113 116
114 def testNoLF(self): 117 def testNoLF(self):
115 # Exactly as testCheckCallAndFilterAndHeader without trailing \n 118 # Exactly as testCheckCallAndFilterAndHeader without trailing \n
116 args = ['boo', 'foo', 'bar'] 119 args = ['boo', 'foo', 'bar']
117 test_string = 'ahah\naccb\nallo\naddb' 120 test_string = 'ahah\naccb\nallo\naddb'
118 self._inner(args, test_string) 121 self._inner(args, test_string)
122 self.checkstdout('\n________ running \'boo foo bar\' in \'bleh\'\n'
123 'ahah\naccb\nallo\naddb\n'
124 '________ running \'boo foo bar\' in \'bleh\'\nahah\naccb\nallo\naddb')
119 125
120 126
121 class SplitUrlRevisionTestCase(GclientUtilBase): 127 class SplitUrlRevisionTestCase(GclientUtilBase):
122 def testSSHUrl(self): 128 def testSSHUrl(self):
123 url = "ssh://test@example.com/test.git" 129 url = "ssh://test@example.com/test.git"
124 rev = "ac345e52dc" 130 rev = "ac345e52dc"
125 out_url, out_rev = gclient_utils.SplitUrlRevision(url) 131 out_url, out_rev = gclient_utils.SplitUrlRevision(url)
126 self.assertEquals(out_rev, None) 132 self.assertEquals(out_rev, None)
127 self.assertEquals(out_url, url) 133 self.assertEquals(out_url, url)
128 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev)) 134 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev))
(...skipping 27 matching lines...) Expand all
156 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev)) 162 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev))
157 self.assertEquals(out_rev, rev) 163 self.assertEquals(out_rev, rev)
158 self.assertEquals(out_url, url) 164 self.assertEquals(out_url, url)
159 165
160 166
161 if __name__ == '__main__': 167 if __name__ == '__main__':
162 import unittest 168 import unittest
163 unittest.main() 169 unittest.main()
164 170
165 # vim: ts=2:sw=2:tw=80:et: 171 # vim: ts=2:sw=2:tw=80:et:
OLDNEW
« no previous file with comments | « tests/gclient_scm_test.py ('k') | tests/super_mox.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698