annotate src/testdir/test_suspend.vim @ 23088:285cde4b8d0e v8.2.2090

patch 8.2.2090: Vim9: dict does not accept a key in quotes Commit: https://github.com/vim/vim/commit/c5e6a7179d7dee4315b412b56e172bb1ff092d3e Author: Bram Moolenaar <Bram@vim.org> Date: Fri Dec 4 19:12:14 2020 +0100 patch 8.2.2090: Vim9: dict does not accept a key in quotes Problem: Vim9: dict does not accept a key in quotes. Solution: Recognize a key in single or double quotes.
author Bram Moolenaar <Bram@vim.org>
date Fri, 04 Dec 2020 19:15:03 +0100
parents 08940efa6b4e
children a916fca16d4b
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
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
3 source check.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()
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
21 CheckFeature terminal
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
22 CheckExecutable /bin/sh
14832
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 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
25 " 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
26 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
27
17700
97b859062d67 patch 8.1.1847: suspend test is failing
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
28 call term_sendkeys(buf, v:progpath
97b859062d67 patch 8.1.1847: suspend test is failing
Bram Moolenaar <Bram@vim.org>
parents: 17698
diff changeset
29 \ . " --clean -X"
14832
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 \ . " -c 'set nu'"
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 \ . " -c 'call setline(1, \"foo\")'"
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 \ . " Xfoo\<CR>")
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 " 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
34 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
35
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 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
37 \ ":stop\<CR>",
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 \ ":suspend!\<CR>",
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 \ ":stop!\<CR>",
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 \ "\<C-Z>"]
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 " 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
42 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
43 call CheckSuspended(buf, 0)
14832
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 endfor
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 " 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
47 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
48 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
49 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
50 " Wait for shell prompt.
16336
b1e69c9e4c67 patch 8.1.1173: suspend test has duplicated lines
Bram Moolenaar <Bram@vim.org>
parents: 15523
diff changeset
51 call CheckSuspended(buf, 1)
14832
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52
15523
47328ce4b7aa patch 8.1.0769: :stop is covered in two tests
Bram Moolenaar <Bram@vim.org>
parents: 14993
diff changeset
53 " 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
54 call term_sendkeys(buf, ":qall!\<CR>")
19954
c087099e9163 patch 8.2.0533: tests using term_wait() can still be flaky
Bram Moolenaar <Bram@vim.org>
parents: 17700
diff changeset
55 call TermWait(buf)
17304
9048b6fb05ce patch 8.1.1651: suspend test is flaky on some systems
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
56 " Wait until Vim actually exited and shell shows a prompt
9048b6fb05ce patch 8.1.1651: suspend test is flaky on some systems
Bram Moolenaar <Bram@vim.org>
parents: 17164
diff changeset
57 call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))})
17164
7927cf327396 patch 8.1.1581: shared functions for testing are disorganised
Bram Moolenaar <Bram@vim.org>
parents: 16336
diff changeset
58 call StopShellInTerminal(buf)
15523
47328ce4b7aa patch 8.1.0769: :stop is covered in two tests
Bram Moolenaar <Bram@vim.org>
parents: 14993
diff changeset
59
14832
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
60 exe buf . 'bwipe!'
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 call delete('Xfoo')
d6752747348a patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62 endfunc
21765
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
63
08940efa6b4e patch 8.2.1432: various inconsistencies in test files
Bram Moolenaar <Bram@vim.org>
parents: 19954
diff changeset
64 " vim: shiftwidth=2 sts=2 expandtab