~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

merge bzr.dev.revno.1905

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
    def test_external_diff(self):
100
100
        lines = external_udiff_lines(['boo\n'], ['goo\n'])
101
101
        self.check_patch(lines)
 
102
        self.assertEqual('\n', lines[-1])
102
103
 
103
104
    def test_external_diff_no_fileno(self):
104
105
        # Make sure that we can handle not having a fileno, even
107
108
                                     ['goo\n']*10000,
108
109
                                     use_stringio=True)
109
110
        self.check_patch(lines)
 
111
 
 
112
    def test_external_diff_binary(self):
 
113
        lines = external_udiff_lines(['\x00foobar\n'], ['foo\x00bar\n'])
 
114
        self.assertEqual(['Binary files old and new differ\n', '\n'], lines)
 
115
 
 
116
    def test_no_external_diff(self):
 
117
        """Check that NoDiff is raised when diff is not available"""
 
118
        # Use os.environ['PATH'] to make sure no 'diff' command is available
 
119
        orig_path = os.environ['PATH']
 
120
        try:
 
121
            os.environ['PATH'] = ''
 
122
            self.assertRaises(NoDiff, external_diff,
 
123
                              'old', ['boo\n'], 'new', ['goo\n'],
 
124
                              StringIO(), diff_opts=['-u'])
 
125
        finally:
 
126
            os.environ['PATH'] = orig_path
110
127
        
111
128
    def test_internal_diff_default(self):
112
129
        # Default internal diff encoding is utf8
304
321
                            working_tree=self.wt)
305
322
        self.assertNotContainsRe(out, 'file1\t')
306
323
 
 
324
 
307
325
class TestPatienceDiffLib(TestCase):
308
326
 
309
327
    def test_unique_lcs(self):