Mercurial > public > mercurial-scm > hg
diff tests/test-bdiff.py @ 15530:eeac5e179243
mdiff: replace wscleanup() regexps with C loops
On my system it reduces:
hg annotate -w mercurial/commands.py
from 36s to less than 8s, to be compared with 6.3s when run without whitespace
options.
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 18 Nov 2011 14:23:03 +0100 |
parents | 4c50552fc9bc |
children | 2e54aaa65afc |
line wrap: on
line diff
--- a/tests/test-bdiff.py Fri Nov 18 14:16:47 2011 +0100 +++ b/tests/test-bdiff.py Fri Nov 18 14:23:03 2011 +0100 @@ -50,3 +50,17 @@ 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" + +def testfixws(a, b, allws): + c = bdiff.fixws(a, allws) + if c != b: + print "*** fixws", repr(a), repr(b), allws + print "got:" + print repr(c) + +testfixws(" \ta\r b\t\n", "ab\n", 1) +testfixws(" \ta\r b\t\n", " a b\n", 0) +testfixws("", "", 1) +testfixws("", "", 0) + +print "done"