diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-30 20:35:25 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-30 20:35:25 +0000 |
commit | 1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (patch) | |
tree | cd08258054db80bb9a11b1061bb091c70b76926a /test/functional/autocmd/safestate_spec.lua | |
parent | eaa89c11d0f8aefbb512de769c6c82f61a8baca3 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-aucmd_textputpost.tar.gz rneovim-aucmd_textputpost.tar.bz2 rneovim-aucmd_textputpost.zip |
Merge remote-tracking branch 'upstream/master' into aucmd_textputpostaucmd_textputpost
Diffstat (limited to 'test/functional/autocmd/safestate_spec.lua')
-rw-r--r-- | test/functional/autocmd/safestate_spec.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/test/functional/autocmd/safestate_spec.lua b/test/functional/autocmd/safestate_spec.lua new file mode 100644 index 0000000000..73693749e4 --- /dev/null +++ b/test/functional/autocmd/safestate_spec.lua @@ -0,0 +1,57 @@ +local helpers = require('test.functional.helpers')(after_each) +local clear = helpers.clear +local eq = helpers.eq +local exec = helpers.exec +local feed = helpers.feed +local meths = helpers.meths + +before_each(clear) + +describe('SafeState autocommand', function() + local function create_autocmd() + exec([[ + let g:safe = 0 + autocmd SafeState * ++once let g:safe += 1 + ]]) + end + + it('with pending operator', function() + feed('d') + create_autocmd() + eq(0, meths.get_var('safe')) + feed('d') + eq(1, meths.get_var('safe')) + end) + + it('with specified register', function() + feed('"r') + create_autocmd() + eq(0, meths.get_var('safe')) + feed('x') + eq(1, meths.get_var('safe')) + end) + + it('with i_CTRL-O', function() + feed('i<C-O>') + create_autocmd() + eq(0, meths.get_var('safe')) + feed('x') + eq(1, meths.get_var('safe')) + end) + + it('with Insert mode completion', function() + feed('i<C-X><C-V>') + create_autocmd() + eq(0, meths.get_var('safe')) + feed('<C-X><C-Z>') + eq(1, meths.get_var('safe')) + end) + + it('with Cmdline completion', function() + feed(':<Tab>') + create_autocmd() + eq(0, meths.get_var('safe')) + feed('<C-E>') + eq(1, meths.get_var('safe')) + end) +end) |