0
0
mirror of https://github.com/vim/vim.git synced 2025-10-01 04:54:07 -04:00

patch 8.2.1062: Vim9: no line break allowed inside "cond ? val1 : val2"

Problem:    Vim9: no line break allowed inside "cond ? val1 : val2".
Solution:   Check for operator after line break.
This commit is contained in:
Bram Moolenaar
2020-06-26 21:28:25 +02:00
parent 5d3c9f8c2a
commit 793648fb56
3 changed files with 35 additions and 2 deletions

View File

@@ -45,6 +45,27 @@ def Test_expr1()
assert_equal(function('len'), RetThat)
enddef
def Test_expr1_vimscript()
" only checks line continuation
let lines =<< trim END
vim9script
let var = 1
? 'yes'
: 'no'
assert_equal('yes', var)
END
CheckScriptSuccess(lines)
lines =<< trim END
vim9script
let var = v:false
? 'yes'
: 'no'
assert_equal('no', var)
END
CheckScriptSuccess(lines)
enddef
func Test_expr1_fails()
call CheckDefFailure(["let x = 1 ? 'one'"], "Missing ':' after '?'")
call CheckDefFailure(["let x = 1 ? 'one' : xxx"], "E1001:")