Test utf8 diffing

This commit is contained in:
shortcutme 2019-03-16 00:57:03 +01:00
parent bf6771152e
commit af38a3927a
No known key found for this signature in database
GPG Key ID: 5B63BAE6CB9613AE
1 changed files with 6 additions and 0 deletions

View File

@ -30,6 +30,12 @@ class TestDiff:
[]
) == [("-", 11)]
def testUtf8(self):
assert Diff.diff(
["one", "\xe5\xad\xa6\xe4\xb9\xa0\xe4\xb8\x8b", "two", "three"],
["one", "\xe5\xad\xa6\xe4\xb9\xa0\xe4\xb8\x8b", "two", "three", "four", "five"]
) == [("=", 20), ("+", ["four", "five"])]
def testDiffLimit(self):
old_f = io.BytesIO(b"one\ntwo\nthree\nhmm\nsix")
new_f = io.BytesIO(b"one\ntwo\nthree\nfour\nfive\nsix")