~neovim-ppa/neovim-ppa/python-neovim

« back to all changes in this revision

Viewing changes to test/test_events.py

  • Committer: Thiago de Arruda
  • Date: 2014-05-27 19:36:12 UTC
  • Revision ID: git-v1:55e2cae446674ca5cc6152f36e5b8ab6b4f1df65
Add event broadcast tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
    eq(events, [['py!', vim.current.buffer.number]])
17
17
 
18
18
 
 
19
@with_setup(setup=cleanup)
 
20
def test_broadcast():
 
21
    vim.subscribe('event2')
 
22
    vim.command('call send_event(0, "event1", [1,2,3])')
 
23
    vim.command('call send_event(0, "event2", [4,5,6])')
 
24
    vim.command('call send_event(0, "event2", [7,8,9])')
 
25
    events = vim.expect('event2', 2, lambda e: e[1][0] == 7)
 
26
    eq(events, [['event2', [4, 5, 6]], ['event2', [7, 8, 9]]])
 
27
    vim.unsubscribe('event2')
 
28
    vim.subscribe('event1')
 
29
    vim.command('call send_event(0, "event2", [10,11,12])')
 
30
    vim.command('call send_event(0, "event1", [13,14,15])')
 
31
    eq(vim.next_event(), ['event1', [13, 14, 15]])
 
32
 
 
33