# HG changeset patch # User Bryan O'Sullivan # Date 1348009742 25200 # Node ID 4038071af82a8c695d9630cf0b15a9528e6300cc # Parent 9535a0dc41f202f207f26b252e78f8fa8db882b8 tests: run test-hybridencode.py over both Python and C encoders This ensures that the two always give the same answers. diff -r 9535a0dc41f2 -r 4038071af82a tests/test-hybridencode.py --- a/tests/test-hybridencode.py Tue Sep 18 15:42:19 2012 -0700 +++ b/tests/test-hybridencode.py Tue Sep 18 16:09:02 2012 -0700 @@ -1,12 +1,22 @@ -from mercurial import store +from mercurial import parsers, store hybridencode = lambda f: store._hybridencode(f, True) -enc = hybridencode # used for 'dotencode' repo format +pathencode = getattr(parsers, 'pathencode', None) +def pencode(f): + pe = pathencode(f) + if pe is None: + return store._hashencode(store.encodedir(f), True) + return pe def show(s): print "A = '%s'" % s.encode("string_escape") - print "B = '%s'" % enc(s).encode("string_escape") + he = hybridencode(s) + print "B = '%s'" % he.encode("string_escape") + if pathencode: + pe = pencode(s) + if pe != he: + print "N = '%s'" % pe.encode("string_escape") print show("data/abcdefghijklmnopqrstuvwxyz0123456789 !#%&'()+,-.;=[]^`{}") @@ -450,4 +460,3 @@ 'VWXYZ-1234567890-xxxxxxxxx-xxxxxxxxx-xxxxxxxx-xxxx' 'xxxxx-wwwwwwwww-wwwwwwwww-wwwwwwwww-wwwwwwwww-wwww' 'wwwww-wwwwwwwww-wwwwwwwww-wwwwwwwww-wwwwwwwww') -