comparison tests/test-status.py @ 34:f6e1d9a6e0cd

client: change return value of status() to a list of (code, file path)
author Idan Kamara <idankk86@gmail.com>
date Sun, 14 Aug 2011 00:51:15 +0300
parents d74a5891d9d1
children 1e33bbea23e5
comparison
equal deleted inserted replaced
33:d74a5891d9d1 34:f6e1d9a6e0cd
1 import common, os 1 import common, os
2 2
3 class test_status(common.basetest): 3 class test_status(common.basetest):
4 def test_empty(self): 4 def test_empty(self):
5 d = dict((c, []) for c in 'MARC!?I') 5 self.assertEquals(self.client.status(), [])
6 self.assertEquals(self.client.status(), d)
7 6
8 def test_one_of_each(self): 7 def test_one_of_each(self):
9 self.append('.hgignore', 'ignored') 8 self.append('.hgignore', 'ignored')
10 self.append('ignored', 'a') 9 self.append('ignored', 'a')
11 self.append('clean', 'a') 10 self.append('clean', 'a')
12 self.append('modified', 'a') 11 self.append('modified', 'a')
13 self.append('removed', 'a') 12 self.append('removed', 'a')
14 self.append('missing', 'a') 13 self.append('missing', 'a')
15 rev0 = self.client.commit('first', addremove=True) 14 self.client.commit('first', addremove=True)
16 self.append('modified', 'a') 15 self.append('modified', 'a')
17 self.append('added', 'a') 16 self.append('added', 'a')
18 self.client.add(['added']) 17 self.client.add(['added'])
19 os.remove('missing') 18 os.remove('missing')
20 self.client.remove(['removed']) 19 self.client.remove(['removed'])
21 self.append('untracked') 20 self.append('untracked')
22 21
23 d = {'M' : ['modified'], 22 l = [('M', 'modified'),
24 'A' : ['added'], 23 ('A', 'added'),
25 'R' : ['removed'], 24 ('R', 'removed'),
26 'C' : ['.hgignore', 'clean'], 25 ('C', '.hgignore'),
27 '!' : ['missing'], 26 ('C', 'clean'),
28 '?' : ['untracked'], 27 ('!', 'missing'),
29 'I' : ['ignored']} 28 ('?', 'untracked'),
29 ('I', 'ignored')]
30 30
31 self.assertEquals(self.client.status(all=True), d) 31 st = self.client.status(all=True)
32
33 for i in l:
34 self.assertTrue(i in st)
35
36 def test_copy(self):
37 self.append('source', 'a')
38 self.client.commit('first', addremove=True)
39 self.client.copy('source', 'dest')
40 l = [('A', 'dest'), (' ', 'source')]
41 self.assertEquals(self.client.status(copies=True), l)