comparison src/testdir/test_terminal.vim @ 12505:5cf248ecb6e3 v8.0.1131

patch 8.0.1131: not easy to trigger an autocommand for new terminal window commit https://github.com/vim/vim/commit/b00fdf6eed5fec589a86655249a851c2d9ba3bb8 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Sep 21 22:16:21 2017 +0200 patch 8.0.1131: not easy to trigger an autocommand for new terminal window Problem: It is not easy to trigger an autocommand for new terminal window. (Marco Restelli) Solution: Trigger BufWinEnter after setting 'buftype'.
author Christian Brabandt <cb@256bit.org>
date Thu, 21 Sep 2017 22:30:04 +0200
parents 65c7769ef6d1
children cdfd6eb8bb80
comparison
equal deleted inserted replaced
12504:418626139d67 12505:5cf248ecb6e3
32 call WaitFor('job_status(g:job) == "dead"') 32 call WaitFor('job_status(g:job) == "dead"')
33 call assert_equal('dead', job_status(g:job)) 33 call assert_equal('dead', job_status(g:job))
34 endfunc 34 endfunc
35 35
36 func Test_terminal_basic() 36 func Test_terminal_basic()
37 au BufWinEnter * if &buftype == 'terminal' | let b:done = 'yes' | endif
37 let buf = Run_shell_in_terminal({}) 38 let buf = Run_shell_in_terminal({})
39
38 if has("unix") 40 if has("unix")
39 call assert_match('^/dev/', job_info(g:job).tty_out) 41 call assert_match('^/dev/', job_info(g:job).tty_out)
40 call assert_match('^/dev/', term_gettty('')) 42 call assert_match('^/dev/', term_gettty(''))
41 else 43 else
42 call assert_match('^\\\\.\\pipe\\', job_info(g:job).tty_out) 44 call assert_match('^\\\\.\\pipe\\', job_info(g:job).tty_out)
43 call assert_match('^\\\\.\\pipe\\', term_gettty('')) 45 call assert_match('^\\\\.\\pipe\\', term_gettty(''))
44 endif 46 endif
45 call assert_equal('t', mode()) 47 call assert_equal('t', mode())
48 call assert_equal('yes', b:done)
46 call assert_match('%aR[^\n]*running]', execute('ls')) 49 call assert_match('%aR[^\n]*running]', execute('ls'))
47 50
48 call Stop_shell_in_terminal(buf) 51 call Stop_shell_in_terminal(buf)
49 call term_wait(buf) 52 call term_wait(buf)
50 call assert_equal('n', mode()) 53 call assert_equal('n', mode())
52 55
53 " closing window wipes out the terminal buffer a with finished job 56 " closing window wipes out the terminal buffer a with finished job
54 close 57 close
55 call assert_equal("", bufname(buf)) 58 call assert_equal("", bufname(buf))
56 59
60 au! BufWinEnter
57 unlet g:job 61 unlet g:job
58 endfunc 62 endfunc
59 63
60 func Test_terminal_make_change() 64 func Test_terminal_make_change()
61 let buf = Run_shell_in_terminal({}) 65 let buf = Run_shell_in_terminal({})