示例#1
0
def test_broadcast():
    vim.subscribe('event2')
    vim.command('call send_event(0, "event1", [1,2,3])')
    vim.command('call send_event(0, "event2", [4,5,6])')
    vim.command('call send_event(0, "event2", [7,8,9])')
    events = vim.expect('event2', 2, lambda e: e[1][0] == 7)
    eq(events, [['event2', [4, 5, 6]], ['event2', [7, 8, 9]]])
    vim.unsubscribe('event2')
    vim.subscribe('event1')
    vim.command('call send_event(0, "event2", [10,11,12])')
    vim.command('call send_event(0, "event1", [13,14,15])')
    eq(vim.next_event(), ['event1', [13, 14, 15]])
示例#2
0
def test_broadcast():
    vim.subscribe('event2')
    vim.command('call rpcnotify(0, "event1", 1, 2, 3)')
    vim.command('call rpcnotify(0, "event2", 4, 5, 6)')
    vim.command('call rpcnotify(0, "event2", 7, 8, 9)')
    event = vim.session.next_message()
    eq(event[1], 'event2')
    eq(event[2], [4, 5, 6])
    event = vim.session.next_message()
    eq(event[1], 'event2')
    eq(event[2], [7, 8, 9])
    vim.unsubscribe('event2')
    vim.subscribe('event1')
    vim.command('call rpcnotify(0, "event2", 10, 11, 12)')
    vim.command('call rpcnotify(0, "event1", 13, 14, 15)')
    msg = vim.session.next_message()
    eq(msg[1], 'event1')
    eq(msg[2], [13, 14, 15])
示例#3
0
def test_broadcast():
    vim.subscribe('event2')
    vim.command('call send_event(0, "event1", [1,2,3])')
    vim.command('call send_event(0, "event2", [4,5,6])')
    vim.command('call send_event(0, "event2", [7,8,9])')
    event = vim.next_message()
    eq(event.name, 'event2')
    eq(event.arg, [4, 5, 6])
    event = vim.next_message()
    eq(event.name, 'event2')
    eq(event.arg, [7, 8, 9])
    vim.unsubscribe('event2')
    vim.subscribe('event1')
    vim.command('call send_event(0, "event2", [10,11,12])')
    vim.command('call send_event(0, "event1", [13,14,15])')
    msg = vim.next_message()
    eq(msg.name, 'event1')
    eq(msg.arg, [13, 14, 15])