Ejemplo n.º 1
0
 def setup_cb():
     vim.vars["result1"] = 0
     vim.vars["result2"] = 0
     vim.vars["result3"] = 0
     vim.vars["result4"] = 0
     cmd = 'let g:result1 = rpcrequest(%d, "call", %d)' % (cid, 2)
     vim.command(cmd)
     eq(vim.vars["result1"], 4)
     eq(vim.vars["result2"], 8)
     eq(vim.vars["result3"], 16)
     eq(vim.vars["result4"], 32)
     vim.stop_loop()
Ejemplo n.º 2
0
 def setup_cb():
     vim.vars['result1'] = 0
     vim.vars['result2'] = 0
     vim.vars['result3'] = 0
     vim.vars['result4'] = 0
     cmd = 'let g:result1 = rpcrequest(%d, "call", %d)' % (
         cid,
         2,
     )
     vim.command(cmd)
     eq(vim.vars['result1'], 4)
     eq(vim.vars['result2'], 8)
     eq(vim.vars['result3'], 16)
     eq(vim.vars['result4'], 32)
     vim.stop_loop()
Ejemplo n.º 3
0
def test_exception_in_threadsafe_call():
    # an exception in a threadsafe_call shouldn't crash the entire host
    msgs = []
    vim.async_call(lambda: [vim.eval("3"), undefined_variable])
    timer = Timer(0.5, lambda: vim.async_call(lambda: vim.stop_loop()))
    timer.start()
    vim.run_loop(None, None, err_cb=msgs.append)
    eq(len(msgs), 1)
    msgs[0].index('NameError')
    msgs[0].index('undefined_variable')
Ejemplo n.º 4
0
def test_exception_in_threadsafe_call():
    # an exception in a threadsafe_call shouldn't crash the entire host
    msgs = []
    vim.async_call(lambda: [vim.eval("3"), undefined_variable])
    timer = Timer(0.5, lambda: vim.async_call(lambda: vim.stop_loop()))
    timer.start()
    vim.run_loop(None, None, err_cb=msgs.append)
    eq(len(msgs), 1)
    msgs[0].index('NameError')
    msgs[0].index('undefined_variable')
Ejemplo n.º 5
0
def test_interrupt_from_another_thread():
    timer = Timer(0.5, lambda: vim.async_call(lambda: vim.stop_loop()))
    timer.start()
    eq(vim.next_message(), None)
Ejemplo n.º 6
0
 def setup_cb():
     cmd = 'let g:result = rpcrequest(%d, "client-call", 1, 2, 3)' % cid
     vim.command(cmd)
     eq(vim.vars['result'], [4, 5, 6])
     vim.stop_loop()
Ejemplo n.º 7
0
 def request_cb(name, args):
     if name == "test-event":
         vim.vars['result'] = 17
     vim.stop_loop()
Ejemplo n.º 8
0
 def setup_cb():
     cmd = 'let g:result = rpcrequest(%d, "client-call", 1, 2, 3)' % cid
     vim.command(cmd)
     eq(vim.vars["result"], [4, 5, 6])
     vim.stop_loop()
Ejemplo n.º 9
0
 def request_cb(name, args):
     if name == "test-event":
         vim.vars["result"] = 17
     vim.stop_loop()
Ejemplo n.º 10
0
def test_interrupt_from_another_thread():
    timer = Timer(0.5, lambda: vim.async_call(lambda: vim.stop_loop()))
    timer.start()
    eq(vim.next_message(), None)