mirror of
https://github.com/vim/vim.git
synced 2025-10-02 05:04:20 -04:00
patch 8.2.1063: Vim9: no line break allowed before || or &&
Problem: Vim9: no line break allowed before || or &&. Solution: Check for operator after line break.
This commit is contained in:
@@ -117,6 +117,26 @@ def Test_expr2()
|
||||
assert_equal([[], '', 0], g:vals)
|
||||
enddef
|
||||
|
||||
def Test_expr2_vimscript()
|
||||
" only checks line continuation
|
||||
let lines =<< trim END
|
||||
vim9script
|
||||
let var = 0
|
||||
|| 1
|
||||
assert_equal(1, var)
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
let var = v:false
|
||||
|| v:true
|
||||
|| v:false
|
||||
assert_equal(1, var)
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
func Test_expr2_fails()
|
||||
let msg = "white space required before and after '||'"
|
||||
call CheckDefFailure(["let x = 1||2"], msg)
|
||||
@@ -160,6 +180,26 @@ def Test_expr3()
|
||||
assert_equal([[1], 'z', 0], g:vals)
|
||||
enddef
|
||||
|
||||
def Test_expr3_vimscript()
|
||||
" only checks line continuation
|
||||
let lines =<< trim END
|
||||
vim9script
|
||||
let var = 0
|
||||
&& 1
|
||||
assert_equal(0, var)
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
let var = v:true
|
||||
&& v:true
|
||||
&& v:true
|
||||
assert_equal(1, var)
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
func Test_expr3_fails()
|
||||
let msg = "white space required before and after '&&'"
|
||||
call CheckDefFailure(["let x = 1&&2"], msg)
|
||||
|
Reference in New Issue
Block a user