Skip to content
Snippets Groups Projects
Commit 42860152 authored by Augie Fackler's avatar Augie Fackler
Browse files

tests: update more of test-bdiff.py to use unittest (part 3 of 4)

parent 0d8cada9
No related branches found
No related tags found
No related merge requests found
......@@ -94,6 +94,18 @@
for old, new, want in cases:
self.assertEqual(self.showdiff(old, new), want)
def test_fixws(self):
cases = [
(" \ta\r b\t\n", "ab\n", 1),
(" \ta\r b\t\n", " a b\n", 0),
("", "", 1),
("", "", 0),
]
for a, b, allws in cases:
c = bdiff.fixws(a, allws)
self.assertEqual(
c, b, 'fixws(%r) want %r got %r (allws=%r)' % (a, b, c, allws))
def showdiff(a, b):
print('showdiff(\n %r,\n %r):' % (a, b))
bin = bdiff.bdiff(a, b)
......@@ -110,20 +122,6 @@
if q < len(a):
print('', repr(a[q:]))
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")
print("Nice diff for a trivial change:")
showdiff(
''.join('<%s\n-\n' % i for i in range(5)),
......
done
Nice diff for a trivial change:
showdiff(
'<0\n-\n<1\n-\n<2\n-\n<3\n-\n<4\n-\n',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment