tests/test-parseindex2.py
changeset 20166 7eda5bb9ec8f
parent 20159 96b2dd77c85d
child 20742 3681de20b0a7
equal deleted inserted replaced
20165:1c92524c37cd 20166:7eda5bb9ec8f
       
     1 """This unit test tests parsers.parse_index2()."""
       
     2 
     1 from mercurial import parsers
     3 from mercurial import parsers
     2 from mercurial.node import nullid, nullrev
     4 from mercurial.node import nullid, nullrev
     3 import struct
     5 import struct
     4 
       
     5 # This unit test compares the return value of the original Python
       
     6 # implementation of parseindex and the new C implementation for
       
     7 # an index file with and without inlined data
       
     8 
     6 
     9 # original python implementation
     7 # original python implementation
    10 def gettype(q):
     8 def gettype(q):
    11     return int(q & 0xFFFF)
     9     return int(q & 0xFFFF)
    12 
    10 
   104     except TypeError:
   102     except TypeError:
   105         pass
   103         pass
   106     else:
   104     else:
   107         print "Expected to get TypeError."
   105         print "Expected to get TypeError."
   108 
   106 
       
   107    # Check parsers.parse_index2() on an index file against the original
       
   108    # Python implementation of parseindex, both with and without inlined data.
       
   109 
   109     py_res_1 = py_parseindex(data_inlined, True)
   110     py_res_1 = py_parseindex(data_inlined, True)
   110     c_res_1 = parse_index2(data_inlined, True)
   111     c_res_1 = parse_index2(data_inlined, True)
   111 
   112 
   112     py_res_2 = py_parseindex(data_non_inlined, False)
   113     py_res_2 = py_parseindex(data_non_inlined, False)
   113     c_res_2 = parse_index2(data_non_inlined, False)
   114     c_res_2 = parse_index2(data_non_inlined, False)