comparison tests/test-manifest.py @ 24495:d2a3a2808974

manifest: make manifest.intersectfiles() internal manifest.intersectfiles() is just a utility used by manifest.matches(), and a future commit removes intersectfiles for treemanifest for optimization purposes. This commit makes the intersectfiles methods on manifestdict and treemanifest internal, and converts its test to a more generic testMatches(), which has the exact same coverage.
author Drew Gottlieb <drgott@google.com>
date Mon, 30 Mar 2015 10:43:52 -0700
parents 016b71ea7dc7
children bcf0de51326e
comparison
equal deleted inserted replaced
24494:f2b87f4856bf 24495:d2a3a2808974
248 def testHugeManifest(self): 248 def testHugeManifest(self):
249 m = parsemanifest(A_HUGE_MANIFEST) 249 m = parsemanifest(A_HUGE_MANIFEST)
250 self.assertEqual(HUGE_MANIFEST_ENTRIES, len(m)) 250 self.assertEqual(HUGE_MANIFEST_ENTRIES, len(m))
251 self.assertEqual(len(m), len(list(m))) 251 self.assertEqual(len(m), len(list(m)))
252 252
253 def testIntersectFiles(self): 253 def testMatches(self):
254 m = parsemanifest(A_HUGE_MANIFEST) 254 m = parsemanifest(A_HUGE_MANIFEST)
255 m2 = m.intersectfiles(['file1', 'file200', 'file300']) 255
256 match = matchmod.match('/', '',
257 ['file1', 'file200', 'file300'], exact=True)
258 m2 = m.matches(match)
259
256 w = ('file1\0%sx\n' 260 w = ('file1\0%sx\n'
257 'file200\0%sl\n' 261 'file200\0%sl\n'
258 'file300\0%s\n') % (HASH_2, HASH_1, HASH_1) 262 'file300\0%s\n') % (HASH_2, HASH_1, HASH_1)
259 self.assertEqual(w, m2.text()) 263 self.assertEqual(w, m2.text())
260 264