tests/run-tests.py
branchstable
changeset 856 e1a5259b3d03
parent 852 fb1e8925292d
child 857 7060aa668b7f
equal deleted inserted replaced
855:eca16536349a 856:e1a5259b3d03
   462 
   462 
   463     pos = prepos = -1
   463     pos = prepos = -1
   464     after = {}
   464     after = {}
   465     expected = {}
   465     expected = {}
   466     for n, l in enumerate(t):
   466     for n, l in enumerate(t):
       
   467         if not l.endswith('\n'):
       
   468             l += '\n'
   467         if l.startswith('  $ '): # commands
   469         if l.startswith('  $ '): # commands
   468             after.setdefault(pos, []).append(l)
   470             after.setdefault(pos, []).append(l)
   469             prepos = pos
   471             prepos = pos
   470             pos = n
   472             pos = n
   471             script.append('echo %s %s $?\n' % (salt, n))
   473             script.append('echo %s %s $?\n' % (salt, n))
   478             expected.setdefault(pos, []).append(l[2:])
   480             expected.setdefault(pos, []).append(l[2:])
   479         else:
   481         else:
   480             # non-command/result - queue up for merged output
   482             # non-command/result - queue up for merged output
   481             after.setdefault(pos, []).append(l)
   483             after.setdefault(pos, []).append(l)
   482 
   484 
   483     if script and not script[-1].endswith('\n'):
       
   484         script[-1] = script[-1] + '\n'
       
   485     script.append('echo %s %s $?\n' % (salt, n + 1))
   485     script.append('echo %s %s $?\n' % (salt, n + 1))
   486 
   486 
   487     fd, name = tempfile.mkstemp(suffix='hg-tst')
   487     fd, name = tempfile.mkstemp(suffix='hg-tst')
   488 
   488 
   489     try:
   489     try: