Mercurial > vim
comparison src/testdir/test_functions.vim @ 19689:da98d2ed8dc5 v8.2.0401
patch 8.2.0401: not enough test coverage for evalvars.c
Commit: https://github.com/vim/vim/commit/8dfcce3a78ccb520cc9d09081f998091494c50bf
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Mar 18 19:32:26 2020 +0100
patch 8.2.0401: not enough test coverage for evalvars.c
Problem: Not enough test coverage for evalvars.c.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5804)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 18 Mar 2020 19:45:04 +0100 |
parents | b38d73f36467 |
children | b3e93a05c3ca |
comparison
equal
deleted
inserted
replaced
19688:8d01c76e0bc7 | 19689:da98d2ed8dc5 |
---|---|
798 unlet def_num | 798 unlet def_num |
799 | 799 |
800 call assert_equal(0, getbufvar(bnr, '&autoindent')) | 800 call assert_equal(0, getbufvar(bnr, '&autoindent')) |
801 call assert_equal(0, getbufvar(bnr, '&autoindent', 1)) | 801 call assert_equal(0, getbufvar(bnr, '&autoindent', 1)) |
802 | 802 |
803 " Set and get a buffer-local variable | |
804 call setbufvar(bnr, 'bufvar_test', ['one', 'two']) | |
805 call assert_equal(['one', 'two'], getbufvar(bnr, 'bufvar_test')) | |
806 | |
803 " Open new window with forced option values | 807 " Open new window with forced option values |
804 set fileformats=unix,dos | 808 set fileformats=unix,dos |
805 new ++ff=dos ++bin ++enc=iso-8859-2 | 809 new ++ff=dos ++bin ++enc=iso-8859-2 |
806 call assert_equal('dos', getbufvar(bufnr('%'), '&fileformat')) | 810 call assert_equal('dos', getbufvar(bufnr('%'), '&fileformat')) |
807 call assert_equal(1, getbufvar(bufnr('%'), '&bin')) | 811 call assert_equal(1, getbufvar(bufnr('%'), '&bin')) |
1496 call assert_fails('call F()', 'E48:') | 1500 call assert_fails('call F()', 'E48:') |
1497 unlet F | 1501 unlet F |
1498 | 1502 |
1499 call assert_fails('call Fsandbox()', 'E48:') | 1503 call assert_fails('call Fsandbox()', 'E48:') |
1500 delfunc Fsandbox | 1504 delfunc Fsandbox |
1505 | |
1506 " From a sandbox try to set a predefined variable (which cannot be modified | |
1507 " from a sandbox) | |
1508 call assert_fails('sandbox let v:lnum = 10', 'E794:') | |
1501 endfunc | 1509 endfunc |
1502 | 1510 |
1503 func EditAnotherFile() | 1511 func EditAnotherFile() |
1504 let word = expand('<cword>') | 1512 let word = expand('<cword>') |
1505 edit Xfuncrange2 | 1513 edit Xfuncrange2 |
2028 call assert_fails("call sign_unplacelist(range(5))", "E715:") | 2036 call assert_fails("call sign_unplacelist(range(5))", "E715:") |
2029 | 2037 |
2030 " sort() | 2038 " sort() |
2031 call assert_equal([0, 1, 2, 3, 4, 5], sort(range(5, 0, -1))) | 2039 call assert_equal([0, 1, 2, 3, 4, 5], sort(range(5, 0, -1))) |
2032 | 2040 |
2033 " 'spellsuggest' | |
2034 func MySuggest() | |
2035 return range(3) | |
2036 endfunc | |
2037 set spell spellsuggest=expr:MySuggest() | |
2038 call assert_equal([], spellsuggest('baord', 3)) | |
2039 set nospell spellsuggest& | |
2040 | |
2041 " string() | 2041 " string() |
2042 call assert_equal('[0, 1, 2, 3, 4]', string(range(5))) | 2042 call assert_equal('[0, 1, 2, 3, 4]', string(range(5))) |
2043 | 2043 |
2044 " taglist() with 'tagfunc' | 2044 " taglist() with 'tagfunc' |
2045 func TagFunc(pattern, flags, info) | 2045 func TagFunc(pattern, flags, info) |