~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Michael Ellerman
  • Date: 2006-02-28 14:45:12 UTC
  • mto: (1558.1.18 Aaron's integration)
  • mto: This revision was merged to the branch mainline in revision 1586.
  • Revision ID: michael@ellerman.id.au-20060228144512-41ad7c2e3056e9ee
Change to -p1 format diffs. Update existing tests to cope, and add some
extra tests for modified/removed/renamed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        output = self.run_bzr_captured(['diff', '-r', 'branch:branch2', 
66
66
                                        'branch1'],
67
67
                                       retcode=1)
68
 
        self.assertEquals(("=== modified file 'file'\n"
69
 
                           "--- file\t\n"
70
 
                           "+++ file\t\n"
 
68
        self.assertEquals(("=== modified file 'a/file'\n"
 
69
                           "--- a/file\t\n"
 
70
                           "+++ b/file\t\n"
71
71
                           "@@ -1,1 +1,1 @@\n"
72
72
                           "-new content\n"
73
73
                           "+contents of branch1/file\n"
74
74
                           "\n", ''), output)
75
75
        output = self.run_bzr_captured(['diff', 'branch2', 'branch1'],
76
76
                                       retcode=1)
77
 
        self.assertEqualDiff(("=== modified file 'file'\n"
78
 
                              "--- file\t\n"
79
 
                              "+++ file\t\n"
 
77
        self.assertEqualDiff(("=== modified file 'a/file'\n"
 
78
                              "--- a/file\t\n"
 
79
                              "+++ b/file\t\n"
80
80
                              "@@ -1,1 +1,1 @@\n"
81
81
                              "-new content\n"
82
82
                              "+contents of branch1/file\n"
119
119
        self.runbzr('checkout branch1 checkouts/branch1')
120
120
        self.runbzr('checkout branch2 checkouts/branch2')
121
121
        os.chdir('checkouts')
 
122
 
 
123
class TestDiffLabels(TestDiff):
 
124
 
 
125
    def test_diff_label_removed(self):
 
126
        super(TestDiffLabels, self).example_branch()
 
127
        self.runbzr('remove hello')
 
128
        diff = self.run_bzr_captured(['diff'], retcode=1)
 
129
        self.assertTrue("=== removed file 'a/hello'" in diff[0])
 
130
 
 
131
    def test_diff_label_added(self):
 
132
        super(TestDiffLabels, self).example_branch()
 
133
        file('barbar', 'wt').write('barbar')
 
134
        self.runbzr('add barbar')
 
135
        diff = self.run_bzr_captured(['diff'], retcode=1)
 
136
        self.assertTrue("=== added file 'b/barbar'" in diff[0])
 
137
 
 
138
    def test_diff_label_modified(self):
 
139
        super(TestDiffLabels, self).example_branch()
 
140
        file('hello', 'wt').write('barbar')
 
141
        diff = self.run_bzr_captured(['diff'], retcode=1)
 
142
        self.assertTrue("=== modified file 'a/hello'" in diff[0])
 
143
 
 
144
    def test_diff_label_renamed(self):
 
145
        super(TestDiffLabels, self).example_branch()
 
146
        self.runbzr('rename hello gruezi')
 
147
        diff = self.run_bzr_captured(['diff'], retcode=1)
 
148
        self.assertTrue("=== renamed file 'a/hello' => 'b/gruezi'" in diff[0])