47
47
self.assert_('@@' in lines[2][2:])
48
48
## "Unterminated hunk header for patch:\n%s" % "".join(lines)
50
class TestCDVDiffLib(TestCase):
52
def test_matching_blocks(self):
53
from bzrlib.cdvdifflib import SequenceMatcher
55
def chk_blocks(a, b, matching):
56
# difflib always adds a signature of the total
57
# length, with no matching entries at the end
58
matching = matching + [(len(a), len(b), 0)]
59
s = SequenceMatcher(None, a, b)
60
self.assertEquals(s.get_matching_blocks(), matching)
62
chk_blocks('', '', [])
63
chk_blocks([], [], [])
64
chk_blocks('abcd', 'abcd', [(0, 0, 4)])
65
chk_blocks('abcd', 'abce', [(0, 0, 3)])
66
chk_blocks('eabc', 'abce', [(1, 0, 3)])
67
chk_blocks('eabce', 'abce', [(1, 0, 4)])
68
chk_blocks('abcde', 'abXde', [(0, 0, 2), (3, 3, 2)])
69
chk_blocks('abcde', 'abXde', [(0, 0, 2), (3, 3, 2)])