/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2007-03-03 17:17:53 UTC
  • mfrom: (2309 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2316.
  • Revision ID: aaron.bentley@utoronto.ca-20070303171753-o0s1yrxx5sn12p2k
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
                  'YYYY-MM-DD HH:MM:SS +ZZZZ', string)
35
35
 
36
36
 
37
 
class TestDiff(ExternalBase):
 
37
class DiffBase(ExternalBase):
 
38
    """Base class with common setup method"""
38
39
 
39
40
    def make_example_branch(self):
40
41
        # FIXME: copied from test_too_much -- share elsewhere?
46
47
        tree.add(['goodbye'])
47
48
        tree.commit('setup')
48
49
 
 
50
 
 
51
class TestDiff(DiffBase):
 
52
 
49
53
    def test_diff(self):
50
54
        self.make_example_branch()
51
55
        file('hello', 'wt').write('hello world!')
114
118
        out, err = self.runbzr('diff does-not-exist', retcode=3)
115
119
        self.assertContainsRe(err, 'not versioned.*does-not-exist')
116
120
 
 
121
    def test_diff_illegal_revision_specifiers(self):
 
122
        out, err = self.runbzr('diff -r 1..23..123', retcode=3)
 
123
        self.assertContainsRe(err, 'one or two revision specifiers')
 
124
 
117
125
    def test_diff_unversioned(self):
118
126
        # Get an error when diffing a non-versioned file.
119
127
        # (Malone #3619)
230
238
        os.chdir('checkouts')
231
239
 
232
240
 
233
 
class TestDiffLabels(TestDiff):
 
241
class TestDiffLabels(DiffBase):
234
242
 
235
243
    def test_diff_label_removed(self):
236
244
        super(TestDiffLabels, self).make_example_branch()
258
266
        self.assertTrue("=== renamed file 'hello' => 'gruezi'" in diff[0])
259
267
 
260
268
 
261
 
class TestExternalDiff(TestDiff):
 
269
class TestExternalDiff(DiffBase):
262
270
 
263
271
    def test_external_diff(self):
264
272
        """Test that we can spawn an external diff process"""
290
298
                                   "+++ goodbye\t")
291
299
        self.assertEndsWith(out, "\n@@ -0,0 +1 @@\n"
292
300
                                 "+baz\n\n")
 
301
 
 
302
 
 
303
class TestDiffOutput(DiffBase):
 
304
 
 
305
    def test_diff_output(self):
 
306
        # check that output doesn't mangle line-endings
 
307
        self.make_example_branch()
 
308
        file('hello', 'wb').write('hello world!\n')
 
309
        output = self.run_bzr_subprocess('diff', retcode=1)[0]
 
310
        self.assert_('\n+hello world!\n' in output)