Mercurial > vim
comparison src/testdir/test_functions.vim @ 19517:738a4fe2c8c5 v8.2.0316
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Commit: https://github.com/vim/vim/commit/8d588ccee57390aa01c2395fc599bbe6506ee13a
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 25 21:47:45 2020 +0100
patch 8.2.0316: ex_getln.c code has insufficient test coverage
Problem: ex_getln.c code has insufficient test coverage.
Solution: Add more tests. Fix a problem. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5693)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 25 Feb 2020 22:00:04 +0100 |
parents | bd9069d21c5d |
children | bab20768e1fd |
comparison
equal
deleted
inserted
replaced
19516:209388e9e179 | 19517:738a4fe2c8c5 |
---|---|
1139 call assert_equal(0, col([1, 100])) | 1139 call assert_equal(0, col([1, 100])) |
1140 call assert_equal(0, col([1])) | 1140 call assert_equal(0, col([1])) |
1141 bw! | 1141 bw! |
1142 endfunc | 1142 endfunc |
1143 | 1143 |
1144 " Test for input() | |
1145 func Test_input_func() | |
1146 " Test for prompt with multiple lines | |
1147 redir => v | |
1148 call feedkeys(":let c = input(\"A\\nB\\nC\\n? \")\<CR>B\<CR>", 'xt') | |
1149 redir END | |
1150 call assert_equal("B", c) | |
1151 call assert_equal(['A', 'B', 'C'], split(v, "\n")) | |
1152 | |
1153 " Test for default value | |
1154 call feedkeys(":let c = input('color? ', 'red')\<CR>\<CR>", 'xt') | |
1155 call assert_equal('red', c) | |
1156 | |
1157 " Test for completion at the input prompt | |
1158 func! Tcomplete(arglead, cmdline, pos) | |
1159 return "item1\nitem2\nitem3" | |
1160 endfunc | |
1161 call feedkeys(":let c = input('Q? ', '' , 'custom,Tcomplete')\<CR>" | |
1162 \ .. "\<C-A>\<CR>", 'xt') | |
1163 delfunc Tcomplete | |
1164 call assert_equal('item1 item2 item3', c) | |
1165 endfunc | |
1166 | |
1167 " Test for inputlist() | |
1144 func Test_inputlist() | 1168 func Test_inputlist() |
1145 call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>1\<cr>", 'tx') | 1169 call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>1\<cr>", 'tx') |
1146 call assert_equal(1, c) | 1170 call assert_equal(1, c) |
1147 call feedkeys(":let c = ['Select color:', '1. red', '2. green', '3. blue']->inputlist()\<cr>2\<cr>", 'tx') | 1171 call feedkeys(":let c = ['Select color:', '1. red', '2. green', '3. blue']->inputlist()\<cr>2\<cr>", 'tx') |
1148 call assert_equal(2, c) | 1172 call assert_equal(2, c) |
2032 | 2056 |
2033 " clean up | 2057 " clean up |
2034 call StopVimInTerminal(buf) | 2058 call StopVimInTerminal(buf) |
2035 call delete('XTest_echoraw') | 2059 call delete('XTest_echoraw') |
2036 endfunc | 2060 endfunc |
2061 | |
2062 " vim: shiftwidth=2 sts=2 expandtab |