Mercurial > vim
annotate src/testdir/test_suspend.vim @ 18732:2513e666aa82 v8.1.2356
patch 8.1.2356: rand() does not use the best algorithm
Commit: https://github.com/vim/vim/commit/f8c1f9200c4b50969a8191a4fe0b0d09edb38979
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Nov 28 22:13:14 2019 +0100
patch 8.1.2356: rand() does not use the best algorithm
Problem: rand() does not use the best algorithm.
Solution: use xoshiro128** instead of xorshift. (Kaito Udagawa,
closes #5279)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 28 Nov 2019 22:15:04 +0100 |
parents | 97b859062d67 |
children | c087099e9163 |
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 |
17700
97b859062d67
patch 8.1.1847: suspend test is failing
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
29 call term_sendkeys(buf, v:progpath |
97b859062d67
patch 8.1.1847: suspend test is failing
Bram Moolenaar <Bram@vim.org>
parents:
17698
diff
changeset
|
30 \ . " --clean -X" |
14832
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) |
17304
9048b6fb05ce
patch 8.1.1651: suspend test is flaky on some systems
Bram Moolenaar <Bram@vim.org>
parents:
17164
diff
changeset
|
57 " 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
|
58 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
|
59 call StopShellInTerminal(buf) |
15523
47328ce4b7aa
patch 8.1.0769: :stop is covered in two tests
Bram Moolenaar <Bram@vim.org>
parents:
14993
diff
changeset
|
60 |
14832
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
61 exe buf . 'bwipe!' |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
62 call delete('Xfoo') |
d6752747348a
patch 8.1.0428: the :suspend command is not tested
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
63 endfunc |