summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0428
blob: 6e3a7b264bbfbd1f03297a226601aa2fa1c82854 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0428
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0428
Problem:    The :suspend command is not tested.
Solution:   Add a test. (Dominique Pelle, closes #3472)
Files:	    src/Make_all.mak, src/testdir/test_alot.vim,
            src/testdir/test_suspend.vim


*** ../vim-8.1.0427/src/Make_all.mak	2018-09-14 20:10:15.874499472 +0200
--- src/Make_all.mak	2018-09-22 21:27:23.453506886 +0200
***************
*** 168,173 ****
--- 168,174 ----
  	test_stat \
  	test_statusline \
  	test_substitute \
+ 	test_suspend \
  	test_swap \
  	test_syn_attr \
  	test_syntax \
*** ../vim-8.1.0427/src/testdir/test_alot.vim	2018-09-14 20:10:15.874499472 +0200
--- src/testdir/test_alot.vim	2018-09-22 21:27:23.453506886 +0200
***************
*** 52,57 ****
--- 52,58 ----
  source test_sort.vim
  source test_sha256.vim
  source test_statusline.vim
+ source test_suspend.vim
  source test_syn_attr.vim
  source test_tabline.vim
  source test_tabpage.vim
*** ../vim-8.1.0427/src/testdir/test_suspend.vim	2018-09-22 21:36:00.066330569 +0200
--- src/testdir/test_suspend.vim	2018-09-22 21:27:23.453506886 +0200
***************
*** 0 ****
--- 1,51 ----
+ " Test :suspend
+ 
+ source shared.vim
+ 
+ func Test_suspend()
+   if !has('terminal') || !executable('/bin/sh')
+     return
+   endif
+ 
+   let buf = term_start('/bin/sh')
+   " Wait for shell prompt.
+   call WaitForAssert({-> assert_match('$ $', term_getline(buf, '.'))})
+ 
+   call term_sendkeys(buf, v:progpath
+         \               . " --clean -X"
+         \               . " -c 'set nu'"
+         \               . " -c 'call setline(1, \"foo\")'"
+         \               . " Xfoo\<CR>")
+   " Cursor in terminal buffer should be on first line in spawned vim.
+   call WaitForAssert({-> assert_equal('  1 foo', term_getline(buf, '.'))})
+ 
+   for suspend_cmd in [":suspend\<CR>",
+         \             ":stop\<CR>",
+         \             ":suspend!\<CR>",
+         \             ":stop!\<CR>",
+         \             "\<C-Z>"]
+     " Suspend and wait for shell prompt.
+     call term_sendkeys(buf, suspend_cmd)
+     call WaitForAssert({-> assert_match('$ $', term_getline(buf, '.'))})
+ 
+     " Without 'autowrite', buffer should not be written.
+     call assert_equal(0, filereadable('Xfoo'))
+ 
+     call term_sendkeys(buf, "fg\<CR>")
+     call WaitForAssert({-> assert_equal('  1 foo', term_getline(buf, '.'))})
+   endfor
+ 
+   " Test that :suspend! with 'autowrite' writes content of buffers if modified.
+   call term_sendkeys(buf, ":set autowrite\<CR>")
+   call assert_equal(0, filereadable('Xfoo'))
+   call term_sendkeys(buf, ":suspend\<CR>")
+   " Wait for shell prompt.
+   call WaitForAssert({-> assert_match('$ $', term_getline(buf, '.'))})
+   call assert_equal(['foo'], readfile('Xfoo'))
+   call term_sendkeys(buf, "fg\<CR>")
+   call WaitForAssert({-> assert_equal('  1 foo', term_getline(buf, '.'))})
+ 
+   exe buf . 'bwipe!'
+   call delete('Xfoo')
+   set autowrite&
+ endfunc
*** ../vim-8.1.0427/src/version.c	2018-09-22 14:39:07.681593221 +0200
--- src/version.c	2018-09-22 21:29:51.436437049 +0200
***************
*** 796,797 ****
--- 796,799 ----
  {   /* Add new patch number below this line */
+ /**/
+     428,
  /**/

-- 
From "know your smileys":
 [:-)	Frankenstein's monster

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///