Mercurial > hgsubversion
comparison tests/test_diff.py @ 138:40474f6c1f84
diff_cmd: more robust, add tests.
| author | Augie Fackler <durin42@gmail.com> |
|---|---|
| date | Thu, 11 Dec 2008 19:49:36 -0600 |
| parents | |
| children | 46f6b872c988 |
comparison
equal
deleted
inserted
replaced
| 137:904a4b08f70f | 138:40474f6c1f84 |
|---|---|
| 1 from mercurial import ui | |
| 2 | |
| 3 import diff_cmd | |
| 4 | |
| 5 import test_util | |
| 6 | |
| 7 expected_diff_output = '''Index: alpha | |
| 8 =================================================================== | |
| 9 --- alpha\t(revision 3) | |
| 10 +++ alpha\t(working copy) | |
| 11 @@ -1,1 +1,3 @@ | |
| 12 -file: alpha | |
| 13 +alpha | |
| 14 + | |
| 15 +added line | |
| 16 Index: foo | |
| 17 =================================================================== | |
| 18 new file mode 100644 | |
| 19 --- foo\t(revision 0) | |
| 20 +++ foo\t(working copy) | |
| 21 @@ -0,0 +1,1 @@ | |
| 22 +This is missing a newline. | |
| 23 \ No newline at end of file | |
| 24 ''' | |
| 25 | |
| 26 class DiffTests(test_util.TestBase): | |
| 27 def test_diff_output(self): | |
| 28 self._load_fixture_and_fetch('two_revs.svndump') | |
| 29 self.commitchanges([('foo', 'foo', 'This is missing a newline.'), | |
| 30 ('alpha', 'alpha', 'alpha\n\nadded line\n'), | |
| 31 ]) | |
| 32 u = ui.ui() | |
| 33 diff_cmd.diff_command(u, self.repo, self.wc_path) | |
| 34 self.assertEqual(u.stream.getvalue(), expected_diff_output) |
