~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Aaron Bentley
  • Date: 2006-04-16 15:52:29 UTC
  • mto: This revision was merged to the branch mainline in revision 1673.
  • Revision ID: aaron.bentley@utoronto.ca-20060416155229-dd8b35cdc5d134ce
Implemented binary file handling for diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from cStringIO import StringIO
 
2
 
 
3
from bzrlib.diff import internal_diff
 
4
from bzrlib.errors import BinaryFile
1
5
from bzrlib.tests import TestCase
2
 
from bzrlib.diff import internal_diff
3
 
from cStringIO import StringIO
 
6
 
 
7
 
4
8
def udiff_lines(old, new):
5
9
    output = StringIO()
6
10
    internal_diff('old', old, 'new', new, output)
47
51
        self.assert_('@@' in lines[2][2:])
48
52
            ## "Unterminated hunk header for patch:\n%s" % "".join(lines)
49
53
 
 
54
    def test_binary_lines(self):
 
55
        self.assertRaises(BinaryFile, udiff_lines, [1023 * 'a' + '\x00'], [])
 
56
        self.assertRaises(BinaryFile, udiff_lines, [], [1023 * 'a' + '\x00'])
 
57
        udiff_lines([1024 * 'a' + '\x00'], [])
 
58
        udiff_lines([], [1024 * 'a' + '\x00'])