Show More
@@ -11,13 +11,12 b' def test1(a, b):' | |||
|
11 | 11 | if d: |
|
12 | 12 | c = mpatch.patches(a, [d]) |
|
13 | 13 | if c != b: |
|
14 | print("***", repr(a), repr(b)) | |
|
15 |
print("b |
|
|
16 |
print( |
|
|
17 | print(repr(d)) | |
|
14 | print("bad diff+patch result from\n %r to\n %r:" % (a, b)) | |
|
15 | print("bdiff: %r" % d) | |
|
16 | print("patched: %r" % c[:200]) | |
|
18 | 17 | |
|
19 | 18 | def test(a, b): |
|
20 |
print(" |
|
|
19 | print("test", repr(a), repr(b)) | |
|
21 | 20 | test1(a, b) |
|
22 | 21 | test1(b, a) |
|
23 | 22 | |
@@ -43,13 +42,21 b' test("a\\nb", "a\\nb")' | |||
|
43 | 42 | |
|
44 | 43 | #issue1295 |
|
45 | 44 | def showdiff(a, b): |
|
45 | print('showdiff(\n %r,\n %r):' % (a, b)) | |
|
46 | 46 | bin = bdiff.bdiff(a, b) |
|
47 | 47 | pos = 0 |
|
48 | q = 0 | |
|
48 | 49 | while pos < len(bin): |
|
49 | 50 | p1, p2, l = struct.unpack(">lll", bin[pos:pos + 12]) |
|
50 | 51 | pos += 12 |
|
51 | print(p1, p2, repr(bin[pos:pos + l])) | |
|
52 | if p1: | |
|
53 | print('', repr(a[q:p1])) | |
|
54 | print('', p1, p2, repr(a[p1:p2]), '->', repr(bin[pos:pos + l])) | |
|
52 | 55 | pos += l |
|
56 | q = p2 | |
|
57 | if q < len(a): | |
|
58 | print('', repr(a[q:])) | |
|
59 | ||
|
53 | 60 | showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\nx\n\nz\n") |
|
54 | 61 | showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\ny\n\nx\n\nz\n") |
|
55 | 62 | # we should pick up abbbc. rather than bc.de as the longest match |
@@ -1,27 +1,44 b'' | |||
|
1 |
|
|
|
2 |
|
|
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
|
|
|
11 |
|
|
|
12 |
|
|
|
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 | 6 6 'y\n\n' | |
|
21 | 6 6 'y\n\n' | |
|
22 | 9 9 'y\n\n' | |
|
23 |
|
|
|
24 | 12 12 'b\nc\n.\n' | |
|
25 | 16 18 '' | |
|
1 | test 'a\nc\n\n\n\n' 'a\nb\n\n\n' | |
|
2 | test 'a\nb\nc\n' 'a\nc\n' | |
|
3 | test '' '' | |
|
4 | test 'a\nb\nc' 'a\nb\nc' | |
|
5 | test 'a\nb\nc\nd\n' 'a\nd\n' | |
|
6 | test 'a\nb\nc\nd\n' 'a\nc\ne\n' | |
|
7 | test 'a\nb\nc\n' 'a\nc\n' | |
|
8 | test 'a\n' 'c\na\nb\n' | |
|
9 | test 'a\n' '' | |
|
10 | test 'a\n' 'b\nc\n' | |
|
11 | test 'a\n' 'c\na\n' | |
|
12 | test '' 'adjfkjdjksdhfksj' | |
|
13 | test '' 'ab' | |
|
14 | test '' 'abc' | |
|
15 | test 'a' 'a' | |
|
16 | test 'ab' 'ab' | |
|
17 | test 'abc' 'abc' | |
|
18 | test 'a\n' 'a\n' | |
|
19 | test 'a\nb' 'a\nb' | |
|
20 | showdiff( | |
|
21 | 'x\n\nx\n\nx\n\nx\n\nz\n', | |
|
22 | 'x\n\nx\n\ny\n\nx\n\nx\n\nz\n'): | |
|
23 | 'x\n\nx\n\n' | |
|
24 | 6 6 '' -> 'y\n\n' | |
|
25 | 'x\n\nx\n\nz\n' | |
|
26 | showdiff( | |
|
27 | 'x\n\nx\n\nx\n\nx\n\nz\n', | |
|
28 | 'x\n\nx\n\ny\n\nx\n\ny\n\nx\n\nz\n'): | |
|
29 | 'x\n\nx\n\n' | |
|
30 | 6 6 '' -> 'y\n\n' | |
|
31 | 'x\n\n' | |
|
32 | 9 9 '' -> 'y\n\n' | |
|
33 | 'x\n\nz\n' | |
|
34 | showdiff( | |
|
35 | 'a\nb\nb\nb\nc\n.\nd\ne\n.\nf\n', | |
|
36 | 'a\nb\nb\na\nb\nb\nb\nc\n.\nb\nc\n.\nd\ne\nf\n'): | |
|
37 | 0 0 '' -> 'a\nb\nb\n' | |
|
38 | 'a\nb\nb\nb\nc\n.\n' | |
|
39 | 12 12 '' -> 'b\nc\n.\n' | |
|
40 | 'd\ne\n' | |
|
41 | 16 18 '.\n' -> '' | |
|
42 | 'f\n' | |
|
26 | 43 | done |
|
27 | 44 | done |
General Comments 0
You need to be logged in to leave comments.
Login now