Show More
@@ -82,18 +82,28 b' class BdiffTests(unittest.TestCase):' | |||
|
82 | 82 | 'x\n\n', |
|
83 | 83 | diffreplace(9, 9, '', 'y\n\n'), |
|
84 | 84 | 'x\n\nz\n']), |
|
85 | # we should pick up abbbc. rather than bc.de as the longest match | |
|
86 | ("a\nb\nb\nb\nc\n.\nd\ne\n.\nf\n", | |
|
87 | "a\nb\nb\na\nb\nb\nb\nc\n.\nb\nc\n.\nd\ne\nf\n", | |
|
88 | ['a\nb\nb\n', | |
|
89 | diffreplace(6, 6, '', 'a\nb\nb\nb\nc\n.\n'), | |
|
90 | 'b\nc\n.\nd\ne\n', | |
|
91 | diffreplace(16, 18, '.\n', ''), | |
|
92 | 'f\n']), | |
|
93 | 85 | ] |
|
94 | 86 | for old, new, want in cases: |
|
95 | 87 | self.assertEqual(self.showdiff(old, new), want) |
|
96 | 88 | |
|
89 | def test_issue1295_varies_on_pure(self): | |
|
90 | # we should pick up abbbc. rather than bc.de as the longest match | |
|
91 | got = self.showdiff("a\nb\nb\nb\nc\n.\nd\ne\n.\nf\n", | |
|
92 | "a\nb\nb\na\nb\nb\nb\nc\n.\nb\nc\n.\nd\ne\nf\n") | |
|
93 | want_c = ['a\nb\nb\n', | |
|
94 | diffreplace(6, 6, '', 'a\nb\nb\nb\nc\n.\n'), | |
|
95 | 'b\nc\n.\nd\ne\n', | |
|
96 | diffreplace(16, 18, '.\n', ''), | |
|
97 | 'f\n'] | |
|
98 | want_pure = [diffreplace(0, 0, '', 'a\nb\nb\n'), | |
|
99 | 'a\nb\nb\nb\nc\n.\n', | |
|
100 | diffreplace(12, 12, '', 'b\nc\n.\n'), | |
|
101 | 'd\ne\n', | |
|
102 | diffreplace(16, 18, '.\n', ''), 'f\n'] | |
|
103 | self.assert_(got in (want_c, want_pure), | |
|
104 | 'got: %r, wanted either %r or %r' % ( | |
|
105 | got, want_c, want_pure)) | |
|
106 | ||
|
97 | 107 | def test_fixws(self): |
|
98 | 108 | cases = [ |
|
99 | 109 | (" \ta\r b\t\n", "ab\n", 1), |
General Comments 0
You need to be logged in to leave comments.
Login now