Mercurial > hgsubversion
annotate tests/test_diff.py @ 177:71d170253a6f
README: document svn:externals support
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 02 Jan 2009 15:54:06 -0600 |
parents | 46f6b872c988 |
children | 28d0ee605308 |
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 |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
5 import diff_cmd |
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() |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
35 diff_cmd.diff_command(u, self.repo, self.wc_path) |
40474f6c1f84
diff_cmd: more robust, add tests.
Augie Fackler <durin42@gmail.com>
parents:
diff
changeset
|
36 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
|
37 |
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 def suite(): |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
40 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
|
41 ] |
46f6b872c988
tests: Fix some missing suite definitions so that running the full testsuite
Augie Fackler <durin42@gmail.com>
parents:
138
diff
changeset
|
42 return unittest.TestSuite(all) |