annotate src/testdir/test_suspend.vim @ 15478:051937ebaf22 v8.1.0747

patch 8.1.0747: map() with a bad expression doesn't give an error commit https://github.com/vim/vim/commit/ce9d50df07402cb8e196537a9c4505845adecabc Author: Bram Moolenaar <Bram@vim.org> Date: Mon Jan 14 22:22:29 2019 +0100 patch 8.1.0747: map() with a bad expression doesn't give an error Problem: map() with a bad expression doesn't give an error. (Ingo Karkat) Solution: Check for giving an error message. (closes https://github.com/vim/vim/issues/3800)
author Bram Moolenaar <Bram@vim.org>
date Mon, 14 Jan 2019 22:30:07 +0100
parents 4234c348aa90
children 47328ce4b7aa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14832
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Test :suspend
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 source shared.vim
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 func Test_suspend()
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 if !has('terminal') || !executable('/bin/sh')
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 return
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 endif
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 let buf = term_start('/bin/sh')
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " Wait for shell prompt.
14993
4234c348aa90 patch 8.1.0508: suspend test fails when run by root
Bram Moolenaar <Bram@vim.org>
parents: 14832
diff changeset
12 call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))})
14832
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call term_sendkeys(buf, v:progpath
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 \ . " --clean -X"
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 \ . " -c 'set nu'"
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 \ . " -c 'call setline(1, \"foo\")'"
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 \ . " Xfoo\<CR>")
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 " Cursor in terminal buffer should be on first line in spawned vim.
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 call WaitForAssert({-> assert_equal(' 1 foo', term_getline(buf, '.'))})
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 for suspend_cmd in [":suspend\<CR>",
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 \ ":stop\<CR>",
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 \ ":suspend!\<CR>",
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 \ ":stop!\<CR>",
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26 \ "\<C-Z>"]
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
27 " Suspend and wait for shell prompt.
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 call term_sendkeys(buf, suspend_cmd)
14993
4234c348aa90 patch 8.1.0508: suspend test fails when run by root
Bram Moolenaar <Bram@vim.org>
parents: 14832
diff changeset
29 call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))})
14832
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 " Without 'autowrite', buffer should not be written.
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 call assert_equal(0, filereadable('Xfoo'))
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 call term_sendkeys(buf, "fg\<CR>")
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 call WaitForAssert({-> assert_equal(' 1 foo', term_getline(buf, '.'))})
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 endfor
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 " Test that :suspend! with 'autowrite' writes content of buffers if modified.
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 call term_sendkeys(buf, ":set autowrite\<CR>")
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 call assert_equal(0, filereadable('Xfoo'))
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 call term_sendkeys(buf, ":suspend\<CR>")
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 " Wait for shell prompt.
14993
4234c348aa90 patch 8.1.0508: suspend test fails when run by root
Bram Moolenaar <Bram@vim.org>
parents: 14832
diff changeset
43 call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))})
14832
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 call assert_equal(['foo'], readfile('Xfoo'))
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 call term_sendkeys(buf, "fg\<CR>")
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 call WaitForAssert({-> assert_equal(' 1 foo', term_getline(buf, '.'))})
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 exe buf . 'bwipe!'
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 call delete('Xfoo')
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 set autowrite&
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
51 endfunc