Mercurial > vim
diff src/testdir/test_excmd.vim @ 19289:2f0f308c069c v8.2.0203
patch 8.2.0203: :helptags and some other functionality not tested
Commit: https://github.com/vim/vim/commit/e20b9ececa37a81c0340a78f61e57fa1bf46b06d
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 3 21:40:04 2020 +0100
patch 8.2.0203: :helptags and some other functionality not tested
Problem: :helptags and some other functionality not tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5567)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 03 Feb 2020 21:45:03 +0100 |
parents | b8fd7364befd |
children | 02111977dd05 |
line wrap: on
line diff
--- a/src/testdir/test_excmd.vim +++ b/src/testdir/test_excmd.vim @@ -1,5 +1,7 @@ " Tests for various Ex commands. +source check.vim + func Test_ex_delete() new call setline(1, ['a', 'b', 'c']) @@ -169,4 +171,74 @@ func Test_change_cmd() close! endfunc +" Test for the :language command +func Test_language_cmd() + CheckFeature multi_lang + + call assert_fails('language ctype non_existing_lang', 'E197:') + call assert_fails('language time non_existing_lang', 'E197:') +endfunc + +" Test for the :confirm command dialog +func Test_confirm_cmd() + CheckNotGui + CheckRunVimInTerminal + + call writefile(['foo1'], 'foo') + call writefile(['bar1'], 'bar') + + " Test for saving all the modified buffers + let buf = RunVimInTerminal('', {'rows': 20}) + call term_sendkeys(buf, ":set nomore\n") + call term_sendkeys(buf, ":new foo\n") + call term_sendkeys(buf, ":call setline(1, 'foo2')\n") + call term_sendkeys(buf, ":new bar\n") + call term_sendkeys(buf, ":call setline(1, 'bar2')\n") + call term_sendkeys(buf, ":wincmd b\n") + call term_sendkeys(buf, ":confirm qall\n") + call WaitForAssert({-> assert_match('\[Y\]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: ', term_getline(buf, 20))}, 1000) + call term_sendkeys(buf, "A") + call StopVimInTerminal(buf) + + call assert_equal(['foo2'], readfile('foo')) + call assert_equal(['bar2'], readfile('bar')) + + " Test for discarding all the changes to modified buffers + let buf = RunVimInTerminal('', {'rows': 20}) + call term_sendkeys(buf, ":set nomore\n") + call term_sendkeys(buf, ":new foo\n") + call term_sendkeys(buf, ":call setline(1, 'foo3')\n") + call term_sendkeys(buf, ":new bar\n") + call term_sendkeys(buf, ":call setline(1, 'bar3')\n") + call term_sendkeys(buf, ":wincmd b\n") + call term_sendkeys(buf, ":confirm qall\n") + call WaitForAssert({-> assert_match('\[Y\]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: ', term_getline(buf, 20))}, 1000) + call term_sendkeys(buf, "D") + call StopVimInTerminal(buf) + + call assert_equal(['foo2'], readfile('foo')) + call assert_equal(['bar2'], readfile('bar')) + + " Test for saving and discarding changes to some buffers + let buf = RunVimInTerminal('', {'rows': 20}) + call term_sendkeys(buf, ":set nomore\n") + call term_sendkeys(buf, ":new foo\n") + call term_sendkeys(buf, ":call setline(1, 'foo4')\n") + call term_sendkeys(buf, ":new bar\n") + call term_sendkeys(buf, ":call setline(1, 'bar4')\n") + call term_sendkeys(buf, ":wincmd b\n") + call term_sendkeys(buf, ":confirm qall\n") + call WaitForAssert({-> assert_match('\[Y\]es, (N)o, Save (A)ll, (D)iscard All, (C)ancel: ', term_getline(buf, 20))}, 1000) + call term_sendkeys(buf, "N") + call WaitForAssert({-> assert_match('\[Y\]es, (N)o, (C)ancel: ', term_getline(buf, 20))}, 1000) + call term_sendkeys(buf, "Y") + call StopVimInTerminal(buf) + + call assert_equal(['foo4'], readfile('foo')) + call assert_equal(['bar2'], readfile('bar')) + + call delete('foo') + call delete('bar') +endfunc + " vim: shiftwidth=2 sts=2 expandtab