aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-15 20:05:03 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-07-15 20:23:48 +0800
commit8bfcff6c4a10f5171e29776eea6498a9856b7200 (patch)
tree785d4c06cf5e3a9d9b428e7c29648dce2ebabd2c
parentba5ff6e5f0d684fb7a5c51d67c159838995199b3 (diff)
downloadrneovim-8bfcff6c4a10f5171e29776eea6498a9856b7200.tar.gz
rneovim-8bfcff6c4a10f5171e29776eea6498a9856b7200.tar.bz2
rneovim-8bfcff6c4a10f5171e29776eea6498a9856b7200.zip
vim-patch:8.2.0542: no test for E386
Problem: No test for E386. Solution: Add a test. (Dominique Pelle, closes vim/vim#5911) https://github.com/vim/vim/commit/8832a3457831707286dd2d9252ba14a5f9fd4c60 Cherry-pick Test_search_errors() from patch 8.2.0448.
-rw-r--r--src/nvim/testdir/test_search.vim20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/nvim/testdir/test_search.vim b/src/nvim/testdir/test_search.vim
index dcdb8df8fc..747fb0e384 100644
--- a/src/nvim/testdir/test_search.vim
+++ b/src/nvim/testdir/test_search.vim
@@ -19,9 +19,9 @@ func Test_search_cmdline()
set noincsearch
:1
call feedkeys("/foobar\<cr>", 'tx')
- call feedkeys("/the\<cr>",'tx')
+ call feedkeys("/the\<cr>", 'tx')
call assert_equal('the', @/)
- call feedkeys("/thes\<C-P>\<C-P>\<cr>",'tx')
+ call feedkeys("/thes\<C-P>\<C-P>\<cr>", 'tx')
call assert_equal('foobar', @/)
" Test 2
@@ -1484,7 +1484,7 @@ func Test_large_hex_chars2()
endfunc
func Test_one_error_msg()
- " This was also giving an internal error
+ " This was also giving an internal error
call assert_fails('call search(" \\((\\v[[=P=]]){185}+ ")', 'E871:')
endfunc
@@ -1529,6 +1529,20 @@ func Test_search_match_at_curpos()
close!
endfunc
+" Test for error cases with the search() function
+func Test_search_errors()
+ call assert_fails("call search('pat', [])", 'E730:')
+ call assert_fails("call search('pat', 'b', {})", 'E728:')
+ call assert_fails("call search('pat', 'b', 1, [])", 'E745:')
+ call assert_fails("call search('pat', 'ns')", 'E475:')
+ call assert_fails("call search('pat', 'mr')", 'E475:')
+
+ new
+ call setline(1, ['foo', 'bar'])
+ call assert_fails('call feedkeys("/foo/;/bar/;\<CR>", "tx")', 'E386:')
+ bwipe!
+endfunc
+
func Test_search_display_pattern()
new
call setline(1, ['foo', 'bar', 'foobar'])