diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-04-07 22:40:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 22:40:01 +0800 |
commit | abc157a6fd5ed2f09271ee3dd75d23d9ec3e0313 (patch) | |
tree | dde71e2d365e1d1eb49453eaf83fd3e03efc2619 /test | |
parent | dc9e436986bec15b027c2a8d78782f514c046a8b (diff) | |
parent | 64802da6c4304a2700d9471d17c0aae143d9aab1 (diff) | |
download | rneovim-abc157a6fd5ed2f09271ee3dd75d23d9ec3e0313.tar.gz rneovim-abc157a6fd5ed2f09271ee3dd75d23d9ec3e0313.tar.bz2 rneovim-abc157a6fd5ed2f09271ee3dd75d23d9ec3e0313.zip |
Merge pull request #18021 from zeertzjq/fix-clearing-reg-executing
Fix clearing of reg_executing
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/editor/macro_spec.lua | 47 |
1 files changed, 44 insertions, 3 deletions
diff --git a/test/functional/editor/macro_spec.lua b/test/functional/editor/macro_spec.lua index c0c9256af2..d4cf6b28fd 100644 --- a/test/functional/editor/macro_spec.lua +++ b/test/functional/editor/macro_spec.lua @@ -6,11 +6,14 @@ local feed = helpers.feed local clear = helpers.clear local expect = helpers.expect local command = helpers.command +local funcs = helpers.funcs +local meths = helpers.meths local insert = helpers.insert local curbufmeths = helpers.curbufmeths +before_each(clear) + describe('macros', function() - before_each(clear) it('can be recorded and replayed', function() feed('qiahello<esc>q') expect('hello') @@ -47,9 +50,47 @@ hello]] end) end) -describe('reg_recorded()', function() - before_each(clear) +describe('immediately after a macro has finished executing,', function() + before_each(function() + command([[let @a = 'gg0']]) + end) + + describe('reg_executing() from RPC returns an empty string', function() + it('if the macro does not end with a <Nop> mapping', function() + feed('@a') + eq('', funcs.reg_executing()) + end) + + it('if the macro ends with a <Nop> mapping', function() + command('nnoremap 0 <Nop>') + feed('@a') + eq('', funcs.reg_executing()) + end) + end) + describe('characters from a mapping are not treated as a part of the macro #18015', function() + before_each(function() + command('nnoremap s qa') + end) + + it('if the macro does not end with a <Nop> mapping', function() + feed('@asq') -- "q" from "s" mapping should start recording a macro instead of being no-op + eq({mode = 'n', blocking = false}, meths.get_mode()) + expect('') + eq('', eval('@a')) + end) + + it('if the macro ends with a <Nop> mapping', function() + command('nnoremap 0 <Nop>') + feed('@asq') -- "q" from "s" mapping should start recording a macro instead of being no-op + eq({mode = 'n', blocking = false}, meths.get_mode()) + expect('') + eq('', eval('@a')) + end) + end) +end) + +describe('reg_recorded()', function() it('returns the correct value', function() feed [[qqyyq]] eq('q', eval('reg_recorded()')) |