diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-03-25 22:15:28 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-03-25 22:15:28 +0100 |
commit | fa984418e7becd8e7d6543cd3ea25f605e9ac97f (patch) | |
tree | 1e8b4185c415271d0d51f74cd56dab2ad05b7ff5 /src/testdir/test_vim9_cmd.vim | |
parent | a91a71322dc2e6a1640e73b6da1f1a2f94f39a54 (diff) | |
download | vim-git-fa984418e7becd8e7d6543cd3ea25f605e9ac97f.tar.gz |
patch 8.2.2652: Vim9: can use command modifier without an effectv8.2.2652
Problem: Vim9: can use command modifier without an effect.
Solution: Give an error for a misplaced command modifier. Fix error message
number.
Diffstat (limited to 'src/testdir/test_vim9_cmd.vim')
-rw-r--r-- | src/testdir/test_vim9_cmd.vim | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_cmd.vim b/src/testdir/test_vim9_cmd.vim index c276a7e6f..bc4cfa6e1 100644 --- a/src/testdir/test_vim9_cmd.vim +++ b/src/testdir/test_vim9_cmd.vim @@ -797,6 +797,55 @@ def Test_silent_pattern() bwipe! enddef +def Test_useless_command_modifier() + g:maybe = true + var lines =<< trim END + if g:maybe + silent endif + END + CheckDefAndScriptFailure(lines, 'E1176:', 2) + + lines =<< trim END + for i in [0] + silent endfor + END + CheckDefAndScriptFailure(lines, 'E1176:', 2) + + lines =<< trim END + while g:maybe + silent endwhile + END + CheckDefAndScriptFailure(lines, 'E1176:', 2) + + lines =<< trim END + silent try + finally + endtry + END + CheckDefAndScriptFailure(lines, 'E1176:', 1) + + lines =<< trim END + try + silent catch + endtry + END + CheckDefAndScriptFailure(lines, 'E1176:', 2) + + lines =<< trim END + try + silent finally + endtry + END + CheckDefAndScriptFailure(lines, 'E1176:', 2) + + lines =<< trim END + try + finally + silent endtry + END + CheckDefAndScriptFailure(lines, 'E1176:', 3) +enddef + def Test_eval_command() var from = 3 var to = 5 |