diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-03-04 21:34:31 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-03-04 21:34:31 +0000 |
commit | 24d9c0557ef52141d12ac32568967b190d247c6f (patch) | |
tree | 49ea9a439a258adc97e5897364ef5a63ca6f7c53 /src/testdir/test_global.vim | |
parent | f07751457c39a645009c17cd837131f6bcdd7d55 (diff) | |
download | vim-git-24d9c0557ef52141d12ac32568967b190d247c6f.tar.gz |
patch 8.2.4506: "pattern not found" for :global is not an error messagev8.2.4506
Problem: "pattern not found" for :global is not an error message.
Solution: In Vim9 script make this an actual error, so that try/catch can be
used as expected.
Diffstat (limited to 'src/testdir/test_global.vim')
-rw-r--r-- | src/testdir/test_global.vim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/testdir/test_global.vim b/src/testdir/test_global.vim index 48753cfcc..62f588afb 100644 --- a/src/testdir/test_global.vim +++ b/src/testdir/test_global.vim @@ -68,6 +68,26 @@ func Test_global_print() v/foo\|bar/p call assert_notequal('', v:statusmsg) + " In Vim9 script this is an error + let caught = 'no' + try + vim9cmd v/foo\|bar/p + catch /E538/ + let caught = 'yes' + call assert_match('E538: Pattern found in every line: foo\|bar', v:exception) + endtry + call assert_equal('yes', caught) + + " In Vim9 script not matching is an error + let caught = 'no' + try + vim9cmd g/foobarnotfound/p + catch /E486/ + let caught = 'yes' + call assert_match('E486: Pattern not found: foobarnotfound', v:exception) + endtry + call assert_equal('yes', caught) + close! endfunc |