annotate tests/test-diff.py @ 75:f4f636ecca3e

tests: add a nose plugin that allows specifying a custom hg to run tests
author Idan Kamara <idankk86@gmail.com>
date Sat, 15 Oct 2011 20:03:04 +0200
parents 5506a241c826
children 86ff8611a8fa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
37
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
1 import common
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
2
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
3 class test_diff(common.basetest):
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
4 def test_basic(self):
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
5 self.append('a', 'a\n')
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
6 self.client.add('a')
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
7 diff1 = """diff -r 000000000000 a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
8 --- /dev/null
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
9 +++ b/a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
10 @@ -0,0 +1,1 @@
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
11 +a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
12 """
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
13 self.assertEquals(diff1, self.client.diff(nodates=True))
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
14 self.assertEquals(diff1, self.client.diff(['a'], nodates=True))
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
15 rev0, node0 = self.client.commit('first')
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
16 diff2 = """diff -r 000000000000 -r %s a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
17 --- /dev/null
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
18 +++ b/a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
19 @@ -0,0 +1,1 @@
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
20 +a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
21 """ % node0[:12]
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
22 self.assertEquals(diff2, self.client.diff(change=rev0, nodates=True))
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
23 self.append('a', 'a\n')
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
24 rev1, node1 = self.client.commit('second')
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
25 diff3 = """diff -r %s a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
26 --- a/a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
27 +++ b/a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
28 @@ -1,1 +1,2 @@
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
29 a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
30 +a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
31 """ % node0[:12]
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
32 self.assertEquals(diff3, self.client.diff(revs=[rev0], nodates=True))
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
33 diff4 = """diff -r %s -r %s a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
34 --- a/a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
35 +++ b/a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
36 @@ -1,1 +1,2 @@
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
37 a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
38 +a
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
39 """ % (node0[:12], node1[:12])
5506a241c826 client: add diff command
Idan Kamara <idankk86@gmail.com>
parents:
diff changeset
40 self.assertEquals(diff4, self.client.diff(revs=[rev0, rev1], nodates=True))