##// END OF EJS Templates
test-progress: disable mocking-time tests on chg...
test-progress: disable mocking-time tests on chg It's hard to make these tests compatible with chg because a mocked time.time() is recorded and accessed by progbar at random timing. I don't think it's worth fixing this test as it is considered a unit test of time estimates, so just ignores on chg.

File last commit:

r28734:4e51f9d1 default
r28881:d9f7f590 default
Show More
test-bdiff.py
70 lines | 1.5 KiB | text/x-python | PythonLexer
Robert Stanca
py3: use print_function in test-bdiff.py
r28734 from __future__ import absolute_import, print_function
Martin Geisler
removed unused imports
r8656 import struct
Robert Stanca
py3: use absolute_import in test-bdiff.py
r28733 from mercurial import (
bdiff,
mpatch,
)
Martin Geisler
tests: renamed Python tests to .py
r8449
def test1(a, b):
d = bdiff.bdiff(a, b)
c = a
if d:
c = mpatch.patches(a, [d])
if c != b:
Robert Stanca
py3: use print_function in test-bdiff.py
r28734 print("***", repr(a), repr(b))
print("bad:")
print(repr(c)[:200])
print(repr(d))
Martin Geisler
tests: renamed Python tests to .py
r8449
def test(a, b):
Robert Stanca
py3: use print_function in test-bdiff.py
r28734 print("***", repr(a), repr(b))
Martin Geisler
tests: renamed Python tests to .py
r8449 test1(a, b)
test1(b, a)
test("a\nc\n\n\n\n", "a\nb\n\n\n")
test("a\nb\nc\n", "a\nc\n")
test("", "")
test("a\nb\nc", "a\nb\nc")
test("a\nb\nc\nd\n", "a\nd\n")
test("a\nb\nc\nd\n", "a\nc\ne\n")
test("a\nb\nc\n", "a\nc\n")
test("a\n", "c\na\nb\n")
test("a\n", "")
test("a\n", "b\nc\n")
test("a\n", "c\na\n")
test("", "adjfkjdjksdhfksj")
test("", "ab")
test("", "abc")
test("a", "a")
test("ab", "ab")
test("abc", "abc")
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
Robert Stanca
py3: use print_function in test-bdiff.py
r28734 print(p1, p2, repr(bin[pos:pos + l]))
Martin Geisler
tests: renamed Python tests to .py
r8449 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")
Robert Stanca
py3: use print_function in test-bdiff.py
r28734 print("done")
Patrick Mezard
mdiff: replace wscleanup() regexps with C loops...
r15530
def testfixws(a, b, allws):
c = bdiff.fixws(a, allws)
if c != b:
Robert Stanca
py3: use print_function in test-bdiff.py
r28734 print("*** fixws", repr(a), repr(b), allws)
print("got:")
print(repr(c))
Patrick Mezard
mdiff: replace wscleanup() regexps with C loops...
r15530
testfixws(" \ta\r b\t\n", "ab\n", 1)
testfixws(" \ta\r b\t\n", " a b\n", 0)
testfixws("", "", 1)
testfixws("", "", 0)
Robert Stanca
py3: use print_function in test-bdiff.py
r28734 print("done")