~bulb/bzr/ignore

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Jan Hudec
  • Date: 2006-05-17 17:49:54 UTC
  • mfrom: (1543.1.168 +trunk)
  • Revision ID: bulb@ucw.cz-20060517174954-f0505b93219a1e36
Updated from bzr.dev and reverted changes to config.
The (unfinished) changes to config broke it's tests, so were reverted.

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
4
 
def udiff_lines(old, new):
 
6
 
 
7
 
 
8
def udiff_lines(old, new, allow_binary=False):
5
9
    output = StringIO()
6
 
    internal_diff('old', old, 'new', new, output)
 
10
    internal_diff('old', old, 'new', new, output, allow_binary)
7
11
    output.seek(0, 0)
8
12
    return output.readlines()
9
13
 
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([1023 * 'a' + '\x00'], [], allow_binary=True)
 
58
        udiff_lines([], [1023 * 'a' + '\x00'], allow_binary=True)