OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2009 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 re | 6 import re |
7 import StringIO | 7 import StringIO |
8 | 8 |
9 import gclient_utils | 9 import gclient_utils |
10 from super_mox import SuperMoxTestBase | 10 from super_mox import SuperMoxTestBase |
11 | 11 |
12 | 12 |
13 class GclientUtilsUnittest(SuperMoxTestBase): | 13 class GclientUtilsUnittest(SuperMoxTestBase): |
14 """General gclient_utils.py tests.""" | 14 """General gclient_utils.py tests.""" |
15 def testMembersChanged(self): | 15 def testMembersChanged(self): |
16 members = [ | 16 members = [ |
17 'CheckCall', 'CheckCallError', 'Error', 'FileRead', 'FileWrite', | 17 'CheckCall', 'CheckCallError', 'Error', 'FileRead', 'FileWrite', |
18 'FindGclientRoot', | 18 'FindGclientRoot', 'GetNamedNodeText', |
19 'FullUrlFromRelative', 'FullUrlFromRelative2', 'GetNamedNodeText', | |
20 'GetNodeNamedAttributeText', 'IsUsingGit', 'PathDifference', | 19 'GetNodeNamedAttributeText', 'IsUsingGit', 'PathDifference', |
21 'ParseXML', 'PrintableObject', 'RemoveDirectory', 'SplitUrlRevision', | 20 'ParseXML', 'PrintableObject', 'RemoveDirectory', 'SplitUrlRevision', |
22 'SubprocessCall', 'SubprocessCallAndFilter', 'errno', 'logging', 'os', | 21 'SubprocessCall', 'SubprocessCallAndFilter', 'errno', 'logging', 'os', |
23 're', 'stat', 'subprocess', 'sys', 'time', 'xml', | 22 're', 'stat', 'subprocess', 'sys', 'time', 'xml', |
24 ] | 23 ] |
25 # If this test fails, you should add the relevant test. | 24 # If this test fails, you should add the relevant test. |
26 self.compareMembers(gclient_utils, members) | 25 self.compareMembers(gclient_utils, members) |
27 | 26 |
28 | 27 |
29 class CheckCallTestCase(SuperMoxTestBase): | 28 class CheckCallTestCase(SuperMoxTestBase): |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 url = "svn://example.com/test" | 130 url = "svn://example.com/test" |
132 rev = "ac345e52dc" | 131 rev = "ac345e52dc" |
133 out_url, out_rev = gclient_utils.SplitUrlRevision(url) | 132 out_url, out_rev = gclient_utils.SplitUrlRevision(url) |
134 self.assertEquals(out_rev, None) | 133 self.assertEquals(out_rev, None) |
135 self.assertEquals(out_url, url) | 134 self.assertEquals(out_url, url) |
136 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev)) | 135 out_url, out_rev = gclient_utils.SplitUrlRevision("%s@%s" % (url, rev)) |
137 self.assertEquals(out_rev, rev) | 136 self.assertEquals(out_rev, rev) |
138 self.assertEquals(out_url, url) | 137 self.assertEquals(out_url, url) |
139 | 138 |
140 | 139 |
141 class FullUrlFromRelative(SuperMoxTestBase): | |
142 def testFullUrlFromRelative(self): | |
143 base_url = 'svn://a/b/c/d' | |
144 full_url = gclient_utils.FullUrlFromRelative(base_url, '/crap') | |
145 self.assertEqual(full_url, 'svn://a/b/crap') | |
146 | |
147 def testFullUrlFromRelative2(self): | |
148 base_url = 'svn://a/b/c/d' | |
149 full_url = gclient_utils.FullUrlFromRelative2(base_url, '/crap') | |
150 self.assertEqual(full_url, 'svn://a/b/c/crap') | |
151 | |
152 | |
153 if __name__ == '__main__': | 140 if __name__ == '__main__': |
154 import unittest | 141 import unittest |
155 unittest.main() | 142 unittest.main() |
156 | 143 |
157 # vim: ts=2:sw=2:tw=80:et: | 144 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |