diff options
author | Shougo Matsushita <Shougo.Matsu@gmail.com> | 2016-02-20 12:59:03 +0900 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2016-02-29 13:21:59 +0100 |
commit | f2ae5a9cc0b93a4373e15a763c56cd391612c0c4 (patch) | |
tree | 00b2ecef8a9887b31c779b52abbbdbb5fc2995ca /test | |
parent | 9c4b34be284faa573a66f5fd68f111634f482f7c (diff) | |
download | rneovim-f2ae5a9cc0b93a4373e15a763c56cd391612c0c4.tar.gz rneovim-f2ae5a9cc0b93a4373e15a763c56cd391612c0c4.tar.bz2 rneovim-f2ae5a9cc0b93a4373e15a763c56cd391612c0c4.zip |
Add TextYankPost and TextDeletePost autocmds
Reviewed by @watiko
Ported from https://github.com/Silex/vim/commit/de53ab72c89affa8ba77536ed8920751c037d127
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/autocmd/text_deletepost.lua | 27 | ||||
-rw-r--r-- | test/functional/autocmd/text_yankpost.lua | 27 |
2 files changed, 54 insertions, 0 deletions
diff --git a/test/functional/autocmd/text_deletepost.lua b/test/functional/autocmd/text_deletepost.lua new file mode 100644 index 0000000000..15c4eafdd4 --- /dev/null +++ b/test/functional/autocmd/text_deletepost.lua @@ -0,0 +1,27 @@ +local helpers = require('test.functional.helpers') +local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq +local feed, execute = helpers.feed, helpers.execute + + +describe('TextDeletePost', function() + before_each(function() + clear() + end) + + describe('au TextDeletePost', function() + it('is executed after delete', function() + feed('ifoo<ESC>') + execute('let g:foo = 0') + execute('autocmd! TextDeletePost * let g:foo = 1') + feed('dd') + eq(1, eval('g:foo')) + end) + it('is not executed after yank', function() + feed('ifoo<ESC>') + execute('let g:foo = 0') + execute('autocmd! TextDeletePost * let g:foo = 1') + feed('yy') + eq(0, eval('g:foo')) + end) + end) +end) diff --git a/test/functional/autocmd/text_yankpost.lua b/test/functional/autocmd/text_yankpost.lua new file mode 100644 index 0000000000..67f3735fa2 --- /dev/null +++ b/test/functional/autocmd/text_yankpost.lua @@ -0,0 +1,27 @@ +local helpers = require('test.functional.helpers') +local clear, eval, eq = helpers.clear, helpers.eval, helpers.eq +local feed, execute = helpers.feed, helpers.execute + + +describe('TextYankPost', function() + before_each(function() + clear() + end) + + describe('autocmd TextYankPost', function() + it('is executed after yank', function() + feed('ifoo<ESC>') + execute('let g:foo = 0') + execute('autocmd! TextYankPost * let g:foo = 1') + feed('yy') + eq(1, eval('g:foo')) + end) + it('is not executed after delete', function() + feed('ifoo<ESC>') + execute('let g:foo = 0') + execute('autocmd! TextYankPost * let g:foo = 1') + feed('dd') + eq(0, eval('g:foo')) + end) + end) +end) |