This revision was automatically updated to reflect the committed changes. Closed by commit rHG215fd73cfe52: testing: add more testing for ifileindex.lookup() (authored by indygreg, committed by ).
REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4796?vs=11479&id=11610 REVISION DETAIL https://phab.mercurial-scm.org/D4796 AFFECTED FILES mercurial/testing/storage.py CHANGE DETAILS diff --git a/mercurial/testing/storage.py b/mercurial/testing/storage.py --- a/mercurial/testing/storage.py +++ b/mercurial/testing/storage.py @@ -90,6 +90,30 @@ with self.assertRaises(error.LookupError): f.lookup(b'%d' % nullrev) + with self.assertRaises(error.LookupError): + f.lookup(b'badvalue') + + self.assertEqual(f.lookup(hex(nullid)[0:12]), nullid) + + with self.assertRaises(error.LookupError): + f.lookup(b'-2') + + # TODO this is wonky. + self.assertEqual(f.lookup(b'0'), nullid) + + with self.assertRaises(error.LookupError): + f.lookup(b'1') + + with self.assertRaises(error.LookupError): + f.lookup(b'11111111111111111111111111111111111111') + + for i in range(-5, 5): + if i == nullrev: + continue + + with self.assertRaises(LookupError): + f.lookup(i) + self.assertEqual(f.linkrev(nullrev), nullrev) for i in range(-5, 5): @@ -170,8 +194,22 @@ self.assertEqual(f.lookup(node), node) self.assertEqual(f.lookup(0), node) + self.assertEqual(f.lookup(-1), nullid) self.assertEqual(f.lookup(b'0'), node) self.assertEqual(f.lookup(hex(node)), node) + self.assertEqual(f.lookup(hex(node)[0:12]), node) + + with self.assertRaises(IndexError): + f.lookup(-2) + + with self.assertRaises(error.LookupError): + f.lookup(b'-2') + + with self.assertRaises(IndexError): + f.lookup(1) + + with self.assertRaises(error.LookupError): + f.lookup(b'1') self.assertEqual(f.linkrev(0), 0) To: indygreg, #hg-reviewers Cc: mercurial-devel _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel