added unit test
This commit is contained in:
@@ -74,6 +74,42 @@ class IndexTest(utils.RepoTestCase):
|
|||||||
self.assertEqual(len(index), 3)
|
self.assertEqual(len(index), 3)
|
||||||
self.assertEqual(index['bye.txt'].hex, sha)
|
self.assertEqual(index['bye.txt'].hex, sha)
|
||||||
|
|
||||||
|
def test_add_all(self):
|
||||||
|
self.test_clear()
|
||||||
|
|
||||||
|
index = self.repo.index
|
||||||
|
|
||||||
|
sha_bye = '0907563af06c7464d62a70cdd135a6ba7d2b41d8'
|
||||||
|
sha_hello = 'a520c24d85fbfc815d385957eed41406ca5a860b'
|
||||||
|
|
||||||
|
index.add_all(['*.txt'])
|
||||||
|
|
||||||
|
self.assertTrue('bye.txt' in index)
|
||||||
|
self.assertTrue('hello.txt' in index)
|
||||||
|
|
||||||
|
self.assertEqual(index['bye.txt'].hex, sha_bye)
|
||||||
|
self.assertEqual(index['hello.txt'].hex, sha_hello)
|
||||||
|
|
||||||
|
self.test_clear()
|
||||||
|
|
||||||
|
index.add_all(['bye.t??', 'hello.*'])
|
||||||
|
|
||||||
|
self.assertTrue('bye.txt' in index)
|
||||||
|
self.assertTrue('hello.txt' in index)
|
||||||
|
|
||||||
|
self.assertEqual(index['bye.txt'].hex, sha_bye)
|
||||||
|
self.assertEqual(index['hello.txt'].hex, sha_hello)
|
||||||
|
|
||||||
|
self.test_clear()
|
||||||
|
|
||||||
|
index.add_all(['[byehlo]*.txt'])
|
||||||
|
|
||||||
|
self.assertTrue('bye.txt' in index)
|
||||||
|
self.assertTrue('hello.txt' in index)
|
||||||
|
|
||||||
|
self.assertEqual(index['bye.txt'].hex, sha_bye)
|
||||||
|
self.assertEqual(index['hello.txt'].hex, sha_hello)
|
||||||
|
|
||||||
def test_clear(self):
|
def test_clear(self):
|
||||||
index = self.repo.index
|
index = self.repo.index
|
||||||
self.assertEqual(len(index), 2)
|
self.assertEqual(len(index), 2)
|
||||||
|
|||||||
Reference in New Issue
Block a user