~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_diff.py

  • Committer: Martin Pool
  • Date: 2006-05-04 05:09:17 UTC
  • mto: This revision was merged to the branch mainline in revision 1699.
  • Revision ID: mbp@sourcefrog.net-20060504050917-dd7516977826b788
Add test for diff --diff-prefix, which was previously untested.

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
    def make_example_branch(test):
31
31
        # FIXME: copied from test_too_much -- share elsewhere?
32
32
        test.runbzr('init')
33
 
        file('hello', 'wt').write('foo')
 
33
        file('hello', 'wt').write('foo\n')
34
34
        test.runbzr('add hello')
35
35
        test.runbzr('commit -m setup hello')
36
 
        file('goodbye', 'wt').write('baz')
 
36
        file('goodbye', 'wt').write('baz\n')
37
37
        test.runbzr('add goodbye')
38
38
        test.runbzr('commit -m setup goodbye')
39
39
 
50
50
        os.unlink('moo')
51
51
        self.runbzr('diff')
52
52
 
 
53
    def test_diff_prefix(self):
 
54
        self.make_example_branch()
 
55
        file('hello', 'wt').write('hello world!\n')
 
56
        out, err = self.runbzr('diff --diff-prefix old/:new/', retcode=1)
 
57
        self.assertEquals(err, '')
 
58
        self.assertEqualDiff(out, '''\
 
59
=== modified file 'old/hello'
 
60
--- old/hello\t
 
61
+++ new/hello\t
 
62
@@ -1,1 +1,1 @@
 
63
-foo
 
64
+hello world!
 
65
 
 
66
''')
 
67
 
53
68
    def test_diff_nonexistent(self):
54
69
        # Get an error from a file that does not exist at all
55
70
        # (Malone #3619)