mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
vim-patch:8.2.1798: Vim9: trinary operator condition is too permissive
Problem: Vim9: trinary operator condition is too permissive.
Solution: Use tv_get_bool_chk().
1310660557
Co-authored-by: Bram Moolenaar <Bram@vim.org>
This commit is contained in:
parent
d6e2804ab4
commit
f12afd8e16
@ -39,6 +39,16 @@ func Test_version()
|
||||
call assert_false(has('patch-9.9.1'))
|
||||
endfunc
|
||||
|
||||
func Test_op_trinary()
|
||||
call assert_equal('yes', 1 ? 'yes' : 'no')
|
||||
call assert_equal('no', 0 ? 'yes' : 'no')
|
||||
call assert_equal('no', 'x' ? 'yes' : 'no')
|
||||
call assert_equal('yes', '1x' ? 'yes' : 'no')
|
||||
|
||||
call assert_fails('echo [1] ? "yes" : "no"', 'E745:')
|
||||
call assert_fails('echo {} ? "yes" : "no"', 'E728:')
|
||||
endfunc
|
||||
|
||||
func Test_op_falsy()
|
||||
call assert_equal(v:true, v:true ?? 456)
|
||||
call assert_equal(123, 123 ?? 456)
|
||||
|
Loading…
Reference in New Issue
Block a user