Mercurial > hgsubversion
annotate tests/test_diff.py @ 256:7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
author | Augie Fackler <durin42@gmail.com> |
---|---|
date | Fri, 10 Apr 2009 18:47:18 -0500 |
parents | 28d0ee605308 |
children | ffccf0080e54 |
rev | line source |
---|---|
153
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
1 import unittest |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
2 |
138
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
3 from mercurial import ui |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
4 |
244
28d0ee605308
Move diff to svncommands.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
153
diff
changeset
|
5 import svncommands |
138
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
6 |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
7 import test_util |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
8 |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
9 expected_diff_output = '''Index: alpha |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
10 =================================================================== |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
11 --- alpha\t(revision 3) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
12 +++ alpha\t(working copy) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
13 @@ -1,1 +1,3 @@ |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
14 -file: alpha |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
15 +alpha |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
16 + |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
17 +added line |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
18 Index: foo |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
19 =================================================================== |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
20 new file mode 100644 |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
21 --- foo\t(revision 0) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
22 +++ foo\t(working copy) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
23 @@ -0,0 +1,1 @@ |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
24 +This is missing a newline. |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
25 \ No newline at end of file |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
26 ''' |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
27 |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
28 class DiffTests(test_util.TestBase): |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
29 def test_diff_output(self): |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
30 self._load_fixture_and_fetch('two_revs.svndump') |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
31 self.commitchanges([('foo', 'foo', 'This is missing a newline.'), |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
32 ('alpha', 'alpha', 'alpha\n\nadded line\n'), |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
33 ]) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
34 u = ui.ui() |
256
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
244
diff
changeset
|
35 svncommands.diff(lambda x,y,z: None, |
7932d098cb5f
Refactor commands to wrap their hg equivalent adding a --svn flag where sane.
Augie Fackler <durin42@gmail.com>
parents:
244
diff
changeset
|
36 u, self.repo, svn=True) |
138
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
37 self.assertEqual(u.stream.getvalue(), expected_diff_output) |
153
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
38 |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
39 |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
40 def suite(): |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
41 all = [unittest.TestLoader().loadTestsFromTestCase(DiffTests), |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
42 ] |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
43 return unittest.TestSuite(all) |