Skip to content
Snippets Groups Projects
Commit de5ae97c authored by Matt Mackall's avatar Matt Mackall
Browse files

encoding: extend test cases for utf8b

This adds a round-trip helper and a few tests of streams that could
cause synchronization problems in the encoder.
parent fa2daf0e
No related branches found
No related tags found
No related merge requests found
......@@ -497,4 +497,5 @@
is a round-trip process for strings like filenames, but metadata
that's was passed through tolocal will remain in UTF-8.
>>> roundtrip = lambda x: fromutf8b(toutf8b(x)) == x
>>> m = "\\xc3\\xa9\\x99abcd"
......@@ -500,4 +501,3 @@
>>> m = "\\xc3\\xa9\\x99abcd"
>>> n = toutf8b(m)
>>> n
>>> toutf8b(m)
'\\xc3\\xa9\\xed\\xb2\\x99abcd'
......@@ -503,5 +503,11 @@
'\\xc3\\xa9\\xed\\xb2\\x99abcd'
>>> fromutf8b(n) == m
>>> roundtrip(m)
True
>>> roundtrip("\\xc2\\xc2\\x80")
True
>>> roundtrip("\\xef\\xbf\\xbd")
True
>>> roundtrip("\\xef\\xef\\xbf\\xbd")
True
'''
......
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