tests/test-bdiff
changeset 7104 9514cbb6e4f6
parent 814 0902ffece4b4
child 7471 94ecd4922a23
--- a/tests/test-bdiff	Wed Oct 15 23:27:35 2008 +0200
+++ b/tests/test-bdiff	Tue Oct 14 20:13:53 2008 +0200
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-import sys
+import sys, struct
 from mercurial import bdiff, mpatch
 
 def test1(a, b):
@@ -39,4 +39,16 @@
 test("a\n", "a\n")
 test("a\nb", "a\nb")
 
+#issue1295
+def showdiff(a, b):
+    bin = bdiff.bdiff(a, b)
+    pos = 0
+    while pos < len(bin):
+        p1, p2, l = struct.unpack(">lll", bin[pos:pos + 12])
+        pos += 12
+        print p1, p2, repr(bin[pos:pos + l])
+        pos += l
+showdiff("x\n\nx\n\nx\n\nx\n\nz\n", "x\n\nx\n\ny\n\nx\n\nx\n\nz\n")
+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")
+
 print "done"