Mercurial > vim
comparison src/testdir/test_functions.vim @ 19906:031184ace7c5 v8.2.0509
patch 8.2.0509: various code is not properly tested.
Commit: https://github.com/vim/vim/commit/cde0ff39da2459b16007fef701ebaa449fb6fe9d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Apr 4 14:00:39 2020 +0200
patch 8.2.0509: various code is not properly tested.
Problem: various code is not properly tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5871)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 04 Apr 2020 14:15:05 +0200 |
parents | 481e8fa158b4 |
children | 2c4d9ca33769 |
comparison
equal
deleted
inserted
replaced
19905:a1a00030eedc | 19906:031184ace7c5 |
---|---|
657 func Save_mode() | 657 func Save_mode() |
658 let g:current_modes = mode(0) . '-' . mode(1) | 658 let g:current_modes = mode(0) . '-' . mode(1) |
659 return '' | 659 return '' |
660 endfunc | 660 endfunc |
661 | 661 |
662 " Test for the mode() function | |
662 func Test_mode() | 663 func Test_mode() |
663 new | 664 new |
664 call append(0, ["Blue Ball Black", "Brown Band Bowl", ""]) | 665 call append(0, ["Blue Ball Black", "Brown Band Bowl", ""]) |
665 | 666 |
666 " Only complete from the current buffer. | 667 " Only complete from the current buffer. |
780 | 781 |
781 call feedkeys(":echo \<C-R>=Save_mode()\<C-U>\<CR>", 'xt') | 782 call feedkeys(":echo \<C-R>=Save_mode()\<C-U>\<CR>", 'xt') |
782 call assert_equal('c-c', g:current_modes) | 783 call assert_equal('c-c', g:current_modes) |
783 call feedkeys("gQecho \<C-R>=Save_mode()\<CR>\<CR>vi\<CR>", 'xt') | 784 call feedkeys("gQecho \<C-R>=Save_mode()\<CR>\<CR>vi\<CR>", 'xt') |
784 call assert_equal('c-cv', g:current_modes) | 785 call assert_equal('c-cv', g:current_modes) |
786 call feedkeys("Qcall Save_mode()\<CR>vi\<CR>", 'xt') | |
787 call assert_equal('c-ce', g:current_modes) | |
785 " How to test Ex mode? | 788 " How to test Ex mode? |
786 | 789 |
787 bwipe! | 790 bwipe! |
788 iunmap <F2> | 791 iunmap <F2> |
789 set complete& | 792 set complete& |
1281 call assert_equal(1, c) | 1284 call assert_equal(1, c) |
1282 call feedkeys(":let c = ['Select color:', '1. red', '2. green', '3. blue']->inputlist()\<cr>2\<cr>", 'tx') | 1285 call feedkeys(":let c = ['Select color:', '1. red', '2. green', '3. blue']->inputlist()\<cr>2\<cr>", 'tx') |
1283 call assert_equal(2, c) | 1286 call assert_equal(2, c) |
1284 call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>3\<cr>", 'tx') | 1287 call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>3\<cr>", 'tx') |
1285 call assert_equal(3, c) | 1288 call assert_equal(3, c) |
1289 | |
1290 " Use backspace to delete characters in the prompt | |
1291 call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>1\<BS>3\<BS>2\<cr>", 'tx') | |
1292 call assert_equal(2, c) | |
1293 | |
1294 " Use mouse to make a selection | |
1295 call test_setmouse(&lines - 3, 2) | |
1296 call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>\<LeftMouse>", 'tx') | |
1297 call assert_equal(1, c) | |
1298 " Mouse click outside of the list | |
1299 call test_setmouse(&lines - 6, 2) | |
1300 call feedkeys(":let c = inputlist(['Select color:', '1. red', '2. green', '3. blue'])\<cr>\<LeftMouse>", 'tx') | |
1301 call assert_equal(-2, c) | |
1286 | 1302 |
1287 call assert_fails('call inputlist("")', 'E686:') | 1303 call assert_fails('call inputlist("")', 'E686:') |
1288 endfunc | 1304 endfunc |
1289 | 1305 |
1290 func Test_balloon_show() | 1306 func Test_balloon_show() |