summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0603
blob: 9fb690ae21f44824186153ba32bd273adbd4128c (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
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0603
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.0603
Problem:    The :stop command is not tested.
Solution:   Test :stop using a terminal window.
Files:	    src/testdir/test_terminal.vim, src/testdir/shared.vim


*** ../vim-8.1.0602/src/testdir/test_terminal.vim	2018-11-12 21:42:20.678152930 +0100
--- src/testdir/test_terminal.vim	2018-12-16 16:04:12.505230125 +0100
***************
*** 1683,1685 ****
--- 1683,1716 ----
  
    call delete('Xfile')
  endfunc
+ 
+ func Test_stop_in_terminal()
+   " We can't expect this to work on all systems, just test on Linux for now.
+   if !has('unix') || system('uname') !~ 'Linux'
+     return
+   endif
+   term /bin/sh
+   let bufnr = bufnr('')
+   call WaitForAssert({-> assert_equal('running', term_getstatus(bufnr))})
+   let lastrow = term_getsize(bufnr)[0]
+ 
+   call term_sendkeys(bufnr, GetVimCommandClean() . "\r")
+   call term_sendkeys(bufnr, ":echo 'ready'\r")
+   call WaitForAssert({-> assert_match('ready', Get_terminal_text(bufnr, lastrow))})
+ 
+   call term_sendkeys(bufnr, ":stop\r")
+   " Not sure where "Stopped" shows up, assume in the first three lines.
+   call WaitForAssert({-> assert_match('Stopped',
+ 	\ Get_terminal_text(bufnr, 1) . 
+ 	\ Get_terminal_text(bufnr, 2) . 
+ 	\ Get_terminal_text(bufnr, 3))})
+ 
+   call term_sendkeys(bufnr, "fg\r")
+   call term_sendkeys(bufnr, ":echo 'back again'\r")
+   call WaitForAssert({-> assert_match('back again', Get_terminal_text(bufnr, lastrow))})
+ 
+   call term_sendkeys(bufnr, ":quit\r")
+   call term_wait(bufnr)
+   call Stop_shell_in_terminal(bufnr)
+   exe bufnr . 'bwipe'
+ endfunc
*** ../vim-8.1.0602/src/testdir/shared.vim	2018-10-12 22:15:06.589268192 +0200
--- src/testdir/shared.vim	2018-12-16 15:54:32.008715839 +0100
***************
*** 345,347 ****
--- 345,357 ----
    let job = term_getjob(a:buf)
    call WaitFor({-> job_status(job) == "dead"})
  endfunc
+ 
+ " Gets the text of a terminal line, using term_scrape()
+ func Get_terminal_text(bufnr, row)
+   let list = term_scrape(a:bufnr, a:row)
+   let text = ''
+   for item in list
+     let text .= item.chars
+   endfor
+   return text
+ endfunc
*** ../vim-8.1.0602/src/version.c	2018-12-16 15:37:58.870807584 +0100
--- src/version.c	2018-12-16 16:15:28.029084965 +0100
***************
*** 801,802 ****
--- 801,804 ----
  {   /* Add new patch number below this line */
+ /**/
+     603,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
27. You refer to your age as 3.x.

 /// 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    ///