aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-06-15 08:05:26 +0800
committerGitHub <noreply@github.com>2023-06-15 08:05:26 +0800
commit78d77c03de579845fcaa761e7339c93fcd74efb2 (patch)
tree07372ce021e0aa7499f56d47a4391326aae05fe8 /test
parentcf6cffda89ad0b22de0ddd4ca7abcb714da812d0 (diff)
downloadrneovim-78d77c03de579845fcaa761e7339c93fcd74efb2.tar.gz
rneovim-78d77c03de579845fcaa761e7339c93fcd74efb2.tar.bz2
rneovim-78d77c03de579845fcaa761e7339c93fcd74efb2.zip
vim-patch:9.0.1631: passing wrong variable type to option gives multiple errors (#24026)
Problem: Passing a wrong variable type to an option gives multiple errors. Solution: Bail out early on failure. (closes vim/vim#12504) https://github.com/vim/vim/commit/4c7cb372c17a84c8a35254d93eb37cb854cd39da
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_let.vim30
-rw-r--r--test/old/testdir/test_options.vim10
-rw-r--r--test/old/testdir/test_vimscript.vim5
3 files changed, 34 insertions, 11 deletions
diff --git a/test/old/testdir/test_let.vim b/test/old/testdir/test_let.vim
index bf119bdeab..a9cc8a14a4 100644
--- a/test/old/testdir/test_let.vim
+++ b/test/old/testdir/test_let.vim
@@ -242,7 +242,7 @@ func Test_let_no_type_checking()
endfunc
func Test_let_termcap()
- throw 'skipped: Nvim does not support termcap option'
+ throw 'Skipped: Nvim does not support termcap options'
" Terminal code
let old_t_te = &t_te
let &t_te = "\<Esc>[yes;"
@@ -257,25 +257,45 @@ func Test_let_termcap()
let &t_k1 = old_t_k1
endif
- call assert_fails('let x = &t_xx', 'E113')
+ call assert_fails('let x = &t_xx', 'E113:')
let &t_xx = "yes"
call assert_equal("yes", &t_xx)
let &t_xx = ""
- call assert_fails('let x = &t_xx', 'E113')
+ call assert_fails('let x = &t_xx', 'E113:')
endfunc
func Test_let_option_error()
let _w = &tw
let &tw = 80
- call assert_fails('let &tw .= 1', 'E734')
+ call assert_fails('let &tw .= 1', ['E734:', 'E734:'])
+ call assert_fails('let &tw .= []', ['E734:', 'E734:'])
+ call assert_fails('let &tw = []', ['E745:', 'E745:'])
+ call assert_fails('let &tw += []', ['E745:', 'E745:'])
call assert_equal(80, &tw)
let &tw = _w
+ let _w = &autoread
+ let &autoread = 1
+ call assert_fails('let &autoread .= 1', ['E734:', 'E734:'])
+ call assert_fails('let &autoread .= []', ['E734:', 'E734:'])
+ call assert_fails('let &autoread = []', ['E745:', 'E745:'])
+ call assert_fails('let &autoread += []', ['E745:', 'E745:'])
+ call assert_equal(1, &autoread)
+ let &autoread = _w
+
let _w = &fillchars
let &fillchars = "vert:|"
- call assert_fails('let &fillchars += "diff:-"', 'E734')
+ call assert_fails('let &fillchars += "diff:-"', ['E734:', 'E734:'])
+ call assert_fails('let &fillchars += []', ['E734:', 'E734:'])
+ call assert_fails('let &fillchars = []', ['E730:', 'E730:'])
+ call assert_fails('let &fillchars .= []', ['E730:', 'E730:'])
call assert_equal("vert:|", &fillchars)
let &fillchars = _w
+
+ call assert_fails('let &nosuchoption = 1', ['E355:', 'E355:'])
+ call assert_fails('let &nosuchoption = ""', ['E355:', 'E355:'])
+ call assert_fails('let &nosuchoption = []', ['E355:', 'E355:'])
+ call assert_fails('let &t_xx = []', ['E730:', 'E730:'])
endfunc
" Errors with the :let statement
diff --git a/test/old/testdir/test_options.vim b/test/old/testdir/test_options.vim
index ada44e5eed..5a30fbbb16 100644
--- a/test/old/testdir/test_options.vim
+++ b/test/old/testdir/test_options.vim
@@ -380,7 +380,7 @@ func Test_set_completion()
call assert_equal('"set filetype=' .. getcompletion('a*', 'filetype')->join(), @:)
endfunc
-func Test_set_errors()
+func Test_set_option_errors()
call assert_fails('set scroll=-1', 'E49:')
call assert_fails('set backupcopy=', 'E474:')
call assert_fails('set regexpengine=3', 'E474:')
@@ -482,7 +482,7 @@ func Test_set_errors()
if has('python') || has('python3')
call assert_fails('set pyxversion=6', 'E474:')
endif
- call assert_fails("let &tabstop='ab'", 'E521:')
+ call assert_fails("let &tabstop='ab'", ['E521:', 'E521:'])
call assert_fails('set spellcapcheck=%\\(', 'E54:')
call assert_fails('set sessionoptions=curdir,sesdir', 'E474:')
call assert_fails('set foldmarker={{{,', 'E474:')
@@ -506,6 +506,12 @@ func Test_set_errors()
" call assert_fails('set t_#-&', 'E522:')
call assert_fails('let &formatoptions = "?"', 'E539:')
call assert_fails('call setbufvar("", "&formatoptions", "?")', 'E539:')
+ call assert_fails('call setwinvar(0, "&scrolloff", [])', ['E745:', 'E745:'])
+ call assert_fails('call setwinvar(0, "&list", [])', ['E745:', 'E745:'])
+ call assert_fails('call setwinvar(0, "&listchars", [])', ['E730:', 'E730:'])
+ call assert_fails('call setwinvar(0, "&nosuchoption", 0)', ['E355:', 'E355:'])
+ call assert_fails('call setwinvar(0, "&nosuchoption", "")', ['E355:', 'E355:'])
+ call assert_fails('call setwinvar(0, "&nosuchoption", [])', ['E355:', 'E355:'])
endfunc
func CheckWasSet(name)
diff --git a/test/old/testdir/test_vimscript.vim b/test/old/testdir/test_vimscript.vim
index 598b359f1f..62487ae5d5 100644
--- a/test/old/testdir/test_vimscript.vim
+++ b/test/old/testdir/test_vimscript.vim
@@ -6997,10 +6997,7 @@ func Test_compound_assignment_operators()
call assert_equal(6, &scrolljump)
let &scrolljump %= 5
call assert_equal(1, &scrolljump)
- " A different error is shown due to a change in implementation of option
- " values.
- " call assert_fails('let &scrolljump .= "j"', 'E734:')
- call assert_fails('let &scrolljump .= "j"', 'E521:')
+ call assert_fails('let &scrolljump .= "j"', ['E734:', 'E734:'])
set scrolljump&vim
let &foldlevelstart = 2