diff options
author | James McCoy <jamessan@jamessan.com> | 2017-02-23 07:30:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-23 07:30:20 -0500 |
commit | 9752a333c32c344eb0cd86b4a3bba4ce6cba3b23 (patch) | |
tree | 8a34046b26b8ae39373005a29f6a72564e3ccf13 /test/functional/ex_cmds/dict_notifications_spec.lua | |
parent | 4e21311f9cceabcfaa6c746518cb2628deb2bb40 (diff) | |
parent | d4dd447ded5e0818fe3e49ebbe59fdafdaae7a1b (diff) | |
download | rneovim-9752a333c32c344eb0cd86b4a3bba4ce6cba3b23.tar.gz rneovim-9752a333c32c344eb0cd86b4a3bba4ce6cba3b23.tar.bz2 rneovim-9752a333c32c344eb0cd86b4a3bba4ce6cba3b23.zip |
Merge pull request #5771 from brcolow/lambda
Lambda Support
Diffstat (limited to 'test/functional/ex_cmds/dict_notifications_spec.lua')
-rw-r--r-- | test/functional/ex_cmds/dict_notifications_spec.lua | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/test/functional/ex_cmds/dict_notifications_spec.lua b/test/functional/ex_cmds/dict_notifications_spec.lua index 5e89986c0f..30753c34ac 100644 --- a/test/functional/ex_cmds/dict_notifications_spec.lua +++ b/test/functional/ex_cmds/dict_notifications_spec.lua @@ -254,23 +254,33 @@ describe('dictionary change notifications', function() command('call g:ReplaceWatcher2()') command('let g:key = "value"') eq({'notification', '2b', {'key', {old = 'v2', new = 'value'}}}, next_msg()) - end) it('does not crash when freeing a watched dictionary', function() source([[ - function! Watcher(dict, key, value) - echo a:key string(a:value) - endfunction + function! Watcher(dict, key, value) + echo a:key string(a:value) + endfunction - function! MakeWatch() - let d = {'foo': 'bar'} - call dictwatcheradd(d, 'foo', function('Watcher')) - endfunction + function! MakeWatch() + let d = {'foo': 'bar'} + call dictwatcheradd(d, 'foo', function('Watcher')) + endfunction ]]) command('call MakeWatch()') eq(2, eval('1+1')) -- Still alive? end) end) + + describe('with lambdas', function() + it('works correctly', function() + source([[ + let d = {'foo': 'baz'} + call dictwatcheradd(d, 'foo', {dict, key, value -> rpcnotify(g:channel, '2', key, value)}) + let d.foo = 'bar' + ]]) + eq({'notification', '2', {'foo', {old = 'baz', new = 'bar'}}}, next_msg()) + end) + end) end) |