tests/test-dispatch.py
changeset 36374 f0c94af0d70d
parent 28405 1d9d29d4813a
child 37924 32106c474086
equal deleted inserted replaced
36373:0147a4730420 36374:f0c94af0d70d
     7 def testdispatch(cmd):
     7 def testdispatch(cmd):
     8     """Simple wrapper around dispatch.dispatch()
     8     """Simple wrapper around dispatch.dispatch()
     9 
     9 
    10     Prints command and result value, but does not handle quoting.
    10     Prints command and result value, but does not handle quoting.
    11     """
    11     """
    12     print("running: %s" % (cmd,))
    12     print(b"running: %s" % (cmd,))
    13     req = dispatch.request(cmd.split())
    13     req = dispatch.request(cmd.split())
    14     result = dispatch.dispatch(req)
    14     result = dispatch.dispatch(req)
    15     print("result: %r" % (result,))
    15     print(b"result: %r" % (result,))
    16 
    16 
    17 testdispatch("init test1")
    17 testdispatch(b"init test1")
    18 os.chdir('test1')
    18 os.chdir('test1')
    19 
    19 
    20 # create file 'foo', add and commit
    20 # create file 'foo', add and commit
    21 f = open('foo', 'wb')
    21 f = open('foo', 'wb')
    22 f.write('foo\n')
    22 f.write(b'foo\n')
    23 f.close()
    23 f.close()
    24 testdispatch("add foo")
    24 testdispatch(b"add foo")
    25 testdispatch("commit -m commit1 -d 2000-01-01 foo")
    25 testdispatch(b"commit -m commit1 -d 2000-01-01 foo")
    26 
    26 
    27 # append to file 'foo' and commit
    27 # append to file 'foo' and commit
    28 f = open('foo', 'ab')
    28 f = open('foo', 'ab')
    29 f.write('bar\n')
    29 f.write(b'bar\n')
    30 f.close()
    30 f.close()
    31 testdispatch("commit -m commit2 -d 2000-01-02 foo")
    31 testdispatch(b"commit -m commit2 -d 2000-01-02 foo")
    32 
    32 
    33 # check 88803a69b24 (fancyopts modified command table)
    33 # check 88803a69b24 (fancyopts modified command table)
    34 testdispatch("log -r 0")
    34 testdispatch(b"log -r 0")
    35 testdispatch("log -r tip")
    35 testdispatch(b"log -r tip")