1
0
forked from aniani/vim

patch 8.2.4348: "legacy exe cmd" does not do what one would expect

Problem:    "legacy exe cmd" does not do what one would expect.
Solution:   Apply the "legacy" and "vim9script" command modifiers to the
            argument of ":execute".
This commit is contained in:
Bram Moolenaar
2022-02-11 20:33:48 +00:00
parent bd89d44063
commit 5b1d6e98c6
6 changed files with 42 additions and 5 deletions

View File

@@ -83,6 +83,31 @@ def Test_vim9cmd()
v9.CheckScriptSuccess(lines)
enddef
def Test_cmdmod_execute()
# "legacy" applies not only to the "exe" argument but also to the commands
var lines =<< trim END
vim9script
b:undo = 'let g:undone = 1 | let g:undtwo = 2'
legacy exe b:undo
assert_equal(1, g:undone)
assert_equal(2, g:undtwo)
END
v9.CheckScriptSuccess(lines)
# same for "vim9cmd" modifier
lines =<< trim END
let b:undo = 'g:undone = 11 | g:undtwo = 22'
vim9cmd exe b:undo
call assert_equal(11, g:undone)
call assert_equal(22, g:undtwo)
END
v9.CheckScriptSuccess(lines)
unlet b:undo
unlet g:undone
unlet g:undtwo
enddef
def Test_edit_wildcards()
var filename = 'Xtest'
edit `=filename`