| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from infra.libs import git2 | 5 from infra.libs import git2 |
| 6 from infra.libs.git2.test import test_util | 6 from infra.libs.git2.test import test_util |
| 7 | 7 |
| 8 | 8 |
| 9 class TestRef(test_util.TestBasis): | 9 class TestRef(test_util.TestBasis): |
| 10 def testComparison(self): | 10 def testComparison(self): |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 list(c.hsh for c in dne.to(O)), | 54 list(c.hsh for c in dne.to(O)), |
| 55 [self.repo[c] for c in 'ABCDLMNO'] | 55 [self.repo[c] for c in 'ABCDLMNO'] |
| 56 ) | 56 ) |
| 57 | 57 |
| 58 def testUpdateTo(self): | 58 def testUpdateTo(self): |
| 59 r = self.mkRepo() | 59 r = self.mkRepo() |
| 60 O = r['refs/heads/branch_O'] | 60 O = r['refs/heads/branch_O'] |
| 61 S = r.get_commit(self.repo['S']) | 61 S = r.get_commit(self.repo['S']) |
| 62 self.capture_stdio(O.update_to, S) | 62 self.capture_stdio(O.update_to, S) |
| 63 self.assertEqual(O.commit.hsh, self.repo['S']) | 63 self.assertEqual(O.commit.hsh, self.repo['S']) |
| 64 |
| 65 def testHash(self): |
| 66 # ensure that Ref's can be used as keys in a dict |
| 67 r = self.mkRepo() |
| 68 mapping = {} |
| 69 mapping[r['refs/heads/branch_O']] = True |
| 70 mapping[r['refs/heads/branch_O']] = True |
| 71 self.assertEqual(len(mapping), 1) |
| OLD | NEW |