added unit test

This commit is contained in:
Leonardo Rhodes
2014-02-13 23:09:40 +01:00
parent 9223d75bb0
commit 1a17256ee3

View File

@@ -74,6 +74,42 @@ class IndexTest(utils.RepoTestCase):
self.assertEqual(len(index), 3)
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):
index = self.repo.index
self.assertEqual(len(index), 2)