diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-01-17 16:16:23 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-01-17 16:16:23 +0100 |
commit | 3af15ab7888033fdfae0ae7085172aab794339a2 (patch) | |
tree | 57c84a4325ffb5bcf4b77b2b36cd10490e16ffc5 /src/testdir/test_vim9_builtin.vim | |
parent | 85773bf32b51cbe7e971c5ac11cb9c743bb7a38a (diff) |
patch 8.2.2369: Vim9: functions return true/false but can't be used as boolv8.2.2369
Problem: Vim9: functions return true/false but can't be used as bool.
Solution: Add ret_number_bool(). (closes #7693)
Diffstat (limited to 'src/testdir/test_vim9_builtin.vim')
-rw-r--r-- | src/testdir/test_vim9_builtin.vim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index 61d129ec23..50dc2a0735 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -115,6 +115,21 @@ def Test_add_blob() CheckDefExecFailure(lines, 'E1131:', 2) enddef +def Test_append() + new + setline(1, range(3)) + var res1: number = append(1, 'one') + assert_equal(0, res1) + var res2: bool = append(3, 'two') + assert_equal(false, res2) + assert_equal(['0', 'one', '1', 'two', '2'], getline(1, 6)) +enddef + +def Test_buflisted() + var res: bool = buflisted('asdf') + assert_equal(false, res) +enddef + def Test_bufname() split SomeFile bufname('%')->assert_equal('SomeFile') @@ -199,6 +214,11 @@ def Test_cursor() CheckDefExecAndScriptFailure(lines, 'E475:') enddef +def Test_delete() + var res: bool = delete('doesnotexist') + assert_equal(true, res) +enddef + def Test_executable() assert_false(executable("")) assert_false(executable(test_null_string())) |