Mercurial > vim
annotate src/testdir/test_suspend.vim @ 17178:40c4cb095d53 v8.1.1588
patch 8.1.1588: in :let-heredoc line continuation is recognized
commit https://github.com/vim/vim/commit/e96a2498f9a2d3e93ac07431f6d4afd77f30afdf
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 25 04:12:16 2019 +0200
patch 8.1.1588: in :let-heredoc line continuation is recognized
Problem: In :let-heredoc line continuation is recognized.
Solution: Do not consume line continuation. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/4580)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 25 Jun 2019 04:15:08 +0200 |
parents | 7927cf327396 |
children | 9048b6fb05ce |
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 |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
16336
diff
changeset
|
4 source term_util.vim |
14832
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
5 |
16336
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
6 func CheckSuspended(buf, fileExists) |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
7 call WaitForAssert({-> assert_match('[$#] $', term_getline(a:buf, '.'))}) |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
8 |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
9 if a:fileExists |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
10 call assert_equal(['foo'], readfile('Xfoo')) |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
11 else |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
12 " Without 'autowrite', buffer should not be written. |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
13 call assert_equal(0, filereadable('Xfoo')) |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
14 endif |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
15 |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
16 call term_sendkeys(a:buf, "fg\<CR>\<C-L>") |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
17 call WaitForAssert({-> assert_equal(' 1 foo', term_getline(a:buf, '.'))}) |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
18 endfunc |
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
19 |
14832
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
20 func Test_suspend() |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
21 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
|
22 return |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
23 endif |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
24 |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
25 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
|
26 " 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
|
27 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
|
28 |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
29 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
|
30 \ . " --clean -X" |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
31 \ . " -c 'set nu'" |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
32 \ . " -c 'call setline(1, \"foo\")'" |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
33 \ . " Xfoo\<CR>") |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
34 " 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
|
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 |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
37 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
|
38 \ ":stop\<CR>", |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
39 \ ":suspend!\<CR>", |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
40 \ ":stop!\<CR>", |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
41 \ "\<C-Z>"] |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
42 " 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
|
43 call term_sendkeys(buf, suspend_cmd) |
16336
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
44 call CheckSuspended(buf, 0) |
14832
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
45 endfor |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
46 |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
47 " 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
|
48 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
|
49 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
|
50 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
|
51 " Wait for shell prompt. |
16336
b1e69c9e4c67
patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents:
15523
diff
changeset
|
52 call CheckSuspended(buf, 1) |
14832
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
53 |
15523
47328ce4b7aa
patch 8.1.0769: :stop is covered in two tests
Bram Moolenaar <Bram@vim.org>
parents:
14993
diff
changeset
|
54 " Quit gracefully to dump coverage information. |
47328ce4b7aa
patch 8.1.0769: :stop is covered in two tests
Bram Moolenaar <Bram@vim.org>
parents:
14993
diff
changeset
|
55 call term_sendkeys(buf, ":qall!\<CR>") |
47328ce4b7aa
patch 8.1.0769: :stop is covered in two tests
Bram Moolenaar <Bram@vim.org>
parents:
14993
diff
changeset
|
56 call term_wait(buf) |
17164
7927cf327396
patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents:
16336
diff
changeset
|
57 call StopShellInTerminal(buf) |
15523
47328ce4b7aa
patch 8.1.0769: :stop is covered in two tests
Bram Moolenaar <Bram@vim.org>
parents:
14993
diff
changeset
|
58 |
14832
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
59 exe buf . 'bwipe!' |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
60 call delete('Xfoo') |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 endfunc |