Mercurial > vim
diff src/testdir/test_vim9_cmd.vim @ 27645:1712b102d642 v8.2.4348
patch 8.2.4348: "legacy exe cmd" does not do what one would expect
Commit: https://github.com/vim/vim/commit/5b1d6e98c6610553fe3946086cdba77718bd69d5
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 11 20:33:48 2022 +0000
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".
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 11 Feb 2022 21:45:03 +0100 |
parents | a31dd0a3cb39 |
children | df84fac1e9a4 |
line wrap: on
line diff
--- a/src/testdir/test_vim9_cmd.vim +++ b/src/testdir/test_vim9_cmd.vim @@ -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`