Show More
@@ -7,6 +7,8 b' import silenttestrunner' | |||||
7 | from mercurial import manifest as manifestmod |
|
7 | from mercurial import manifest as manifestmod | |
8 | from mercurial import match as matchmod |
|
8 | from mercurial import match as matchmod | |
9 |
|
9 | |||
|
10 | EMTPY_MANIFEST = '' | |||
|
11 | ||||
10 | HASH_1 = '1' * 40 |
|
12 | HASH_1 = '1' * 40 | |
11 | HASH_2 = 'f' * 40 |
|
13 | HASH_2 = 'f' * 40 | |
12 | HASH_3 = '1234567890abcdef0987654321deadbeef0fcafe' |
|
14 | HASH_3 = '1234567890abcdef0987654321deadbeef0fcafe' | |
@@ -68,7 +70,7 b' class testmanifest(unittest.TestCase):' | |||||
68 | self.assert_(thing in container, msg) |
|
70 | self.assert_(thing in container, msg) | |
69 |
|
71 | |||
70 | def testEmptyManifest(self): |
|
72 | def testEmptyManifest(self): | |
71 |
m = parsemanifest( |
|
73 | m = parsemanifest(EMTPY_MANIFEST) | |
72 | self.assertEqual(0, len(m)) |
|
74 | self.assertEqual(0, len(m)) | |
73 | self.assertEqual([], list(m)) |
|
75 | self.assertEqual([], list(m)) | |
74 |
|
76 | |||
@@ -84,7 +86,7 b' class testmanifest(unittest.TestCase):' | |||||
84 | def testSetItem(self): |
|
86 | def testSetItem(self): | |
85 | want = binascii.unhexlify(HASH_1) |
|
87 | want = binascii.unhexlify(HASH_1) | |
86 |
|
88 | |||
87 |
m = parsemanifest( |
|
89 | m = parsemanifest(EMTPY_MANIFEST) | |
88 | m['a'] = want |
|
90 | m['a'] = want | |
89 | self.assertIn('a', m) |
|
91 | self.assertIn('a', m) | |
90 | self.assertEqual(want, m['a']) |
|
92 | self.assertEqual(want, m['a']) | |
@@ -99,7 +101,7 b' class testmanifest(unittest.TestCase):' | |||||
99 | def testSetFlag(self): |
|
101 | def testSetFlag(self): | |
100 | want = 'x' |
|
102 | want = 'x' | |
101 |
|
103 | |||
102 |
m = parsemanifest( |
|
104 | m = parsemanifest(EMTPY_MANIFEST) | |
103 | # first add a file; a file-less flag makes no sense |
|
105 | # first add a file; a file-less flag makes no sense | |
104 | m['a'] = binascii.unhexlify(HASH_1) |
|
106 | m['a'] = binascii.unhexlify(HASH_1) | |
105 | m.setflag('a', want) |
|
107 | m.setflag('a', want) | |
@@ -214,14 +216,14 b' class testmanifest(unittest.TestCase):' | |||||
214 | 'foo': (MISSING, (binascii.unhexlify(HASH_3), 'x')), |
|
216 | 'foo': (MISSING, (binascii.unhexlify(HASH_3), 'x')), | |
215 | 'z-only-in-left': (MISSING, (binascii.unhexlify(HASH_1), '')), |
|
217 | 'z-only-in-left': (MISSING, (binascii.unhexlify(HASH_1), '')), | |
216 | } |
|
218 | } | |
217 |
self.assertEqual(want, parsemanifest( |
|
219 | self.assertEqual(want, parsemanifest(EMTPY_MANIFEST).diff(left)) | |
218 |
|
220 | |||
219 | want = { |
|
221 | want = { | |
220 | 'bar/baz/qux.py': ((binascii.unhexlify(HASH_2), 'l'), MISSING), |
|
222 | 'bar/baz/qux.py': ((binascii.unhexlify(HASH_2), 'l'), MISSING), | |
221 | 'foo': ((binascii.unhexlify(HASH_3), 'x'), MISSING), |
|
223 | 'foo': ((binascii.unhexlify(HASH_3), 'x'), MISSING), | |
222 | 'z-only-in-left': ((binascii.unhexlify(HASH_1), ''), MISSING), |
|
224 | 'z-only-in-left': ((binascii.unhexlify(HASH_1), ''), MISSING), | |
223 | } |
|
225 | } | |
224 |
self.assertEqual(want, left.diff(parsemanifest( |
|
226 | self.assertEqual(want, left.diff(parsemanifest(EMTPY_MANIFEST))) | |
225 | copy = right.copy() |
|
227 | copy = right.copy() | |
226 | del copy['z-only-in-right'] |
|
228 | del copy['z-only-in-right'] | |
227 | del right['foo'] |
|
229 | del right['foo'] |
General Comments 0
You need to be logged in to leave comments.
Login now