annotate src/testdir/test_suspend.vim @ 15290:424f2596f582 v8.1.0653

patch 8.1.0653: arglist test fails on MS-windows commit https://github.com/vim/vim/commit/3de8c2d1f027410db6a06f0fcd3355d96c8b8596 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 28 19:29:35 2018 +0100 patch 8.1.0653: arglist test fails on MS-windows Problem: Arglist test fails on MS-windows. Solution: Only use a file name with a double quote on Unix.
author Bram Moolenaar <Bram@vim.org>
date Fri, 28 Dec 2018 19:30:06 +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