Mercurial > vim
comparison src/testdir/test_suspend.vim @ 14993:4234c348aa90 v8.1.0508
patch 8.1.0508: suspend test fails when run by root
commit https://github.com/vim/vim/commit/0f62cf5b335968f7448af1a6f46e0104b7bc365e
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Nov 3 21:09:15 2018 +0100
patch 8.1.0508: suspend test fails when run by root
Problem: Suspend test fails when run by root.
Solution: Accept both '$' and '#' for the prompt. (James McCoy, closes https://github.com/vim/vim/issues/3590)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 03 Nov 2018 21:15:05 +0100 |
parents | d6752747348a |
children | 47328ce4b7aa |
comparison
equal
deleted
inserted
replaced
14992:3916597e1b30 | 14993:4234c348aa90 |
---|---|
7 return | 7 return |
8 endif | 8 endif |
9 | 9 |
10 let buf = term_start('/bin/sh') | 10 let buf = term_start('/bin/sh') |
11 " Wait for shell prompt. | 11 " Wait for shell prompt. |
12 call WaitForAssert({-> assert_match('$ $', term_getline(buf, '.'))}) | 12 call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))}) |
13 | 13 |
14 call term_sendkeys(buf, v:progpath | 14 call term_sendkeys(buf, v:progpath |
15 \ . " --clean -X" | 15 \ . " --clean -X" |
16 \ . " -c 'set nu'" | 16 \ . " -c 'set nu'" |
17 \ . " -c 'call setline(1, \"foo\")'" | 17 \ . " -c 'call setline(1, \"foo\")'" |
24 \ ":suspend!\<CR>", | 24 \ ":suspend!\<CR>", |
25 \ ":stop!\<CR>", | 25 \ ":stop!\<CR>", |
26 \ "\<C-Z>"] | 26 \ "\<C-Z>"] |
27 " Suspend and wait for shell prompt. | 27 " Suspend and wait for shell prompt. |
28 call term_sendkeys(buf, suspend_cmd) | 28 call term_sendkeys(buf, suspend_cmd) |
29 call WaitForAssert({-> assert_match('$ $', term_getline(buf, '.'))}) | 29 call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))}) |
30 | 30 |
31 " Without 'autowrite', buffer should not be written. | 31 " Without 'autowrite', buffer should not be written. |
32 call assert_equal(0, filereadable('Xfoo')) | 32 call assert_equal(0, filereadable('Xfoo')) |
33 | 33 |
34 call term_sendkeys(buf, "fg\<CR>") | 34 call term_sendkeys(buf, "fg\<CR>") |
38 " Test that :suspend! with 'autowrite' writes content of buffers if modified. | 38 " Test that :suspend! with 'autowrite' writes content of buffers if modified. |
39 call term_sendkeys(buf, ":set autowrite\<CR>") | 39 call term_sendkeys(buf, ":set autowrite\<CR>") |
40 call assert_equal(0, filereadable('Xfoo')) | 40 call assert_equal(0, filereadable('Xfoo')) |
41 call term_sendkeys(buf, ":suspend\<CR>") | 41 call term_sendkeys(buf, ":suspend\<CR>") |
42 " Wait for shell prompt. | 42 " Wait for shell prompt. |
43 call WaitForAssert({-> assert_match('$ $', term_getline(buf, '.'))}) | 43 call WaitForAssert({-> assert_match('[$#] $', term_getline(buf, '.'))}) |
44 call assert_equal(['foo'], readfile('Xfoo')) | 44 call assert_equal(['foo'], readfile('Xfoo')) |
45 call term_sendkeys(buf, "fg\<CR>") | 45 call term_sendkeys(buf, "fg\<CR>") |
46 call WaitForAssert({-> assert_equal(' 1 foo', term_getline(buf, '.'))}) | 46 call WaitForAssert({-> assert_equal(' 1 foo', term_getline(buf, '.'))}) |
47 | 47 |
48 exe buf . 'bwipe!' | 48 exe buf . 'bwipe!' |