endfunc
func Test_terminal_postponed_scrollback()
- if !has('unix')
- " tail -f only works on Unix
- return
- endif
+ " tail -f only works on Unix
+ CheckUnix
call writefile(range(50), 'Xtext')
call writefile([
func Test_terminal_special_chars()
" this file name only works on Unix
- if !has('unix')
- return
- endif
+ CheckUnix
+
call mkdir('Xdir with spaces')
call writefile(['x'], 'Xdir with spaces/quoted"file')
term ls Xdir\ with\ spaces/quoted\"file
endfunc
func Test_terminal_response_to_control_sequence()
- if !has('unix')
- return
- endif
+ CheckUnix
let buf = Run_shell_in_terminal({})
call WaitForAssert({-> assert_notequal('', term_getline(buf, 1))})
endfunc
func Test_terminal_out_err()
- if !has('unix')
- return
- endif
+ CheckUnix
+
call writefile([
\ '#!/bin/sh',
\ 'echo "this is standard error" >&2',
endfunc
func Test_terminwinscroll()
- if !has('unix')
- return
- endif
+ CheckUnix
" Let the terminal output more than 'termwinscroll' lines, some at the start
" will be dropped.
endfunc
func Test_terminal_hidden()
- if !has('unix')
- return
- endif
+ CheckUnix
+
term ++hidden cat
let bnr = bufnr('$')
call assert_equal('terminal', getbufvar(bnr, '&buftype'))
endfunc
func Test_terminal_hidden_and_close()
- if !has('unix')
- return
- endif
+ CheckUnix
+
call assert_equal(1, winnr('$'))
term ++hidden ++close ls
let bnr = bufnr('$')
endfunc
func Test_term_getcursor()
- if !has('unix')
- return
- endif
+ CheckUnix
+
let buf = Run_shell_in_terminal({})
" Wait for the shell to display a prompt.
" 4. 0.5 sec later: redraw, including statusline (used to trigger bug)
" 4. 0.5 sec later: should be done, clean up
func Test_terminal_statusline()
- if !has('unix')
- return
- endif
+ CheckUnix
+
set statusline=x
terminal
let tbuf = bufnr('')
endfunc
func Test_terminal_altscreen()
- if has('win32')
- let cmd = "type Xtext\<CR>"
- else
- let cmd = "cat Xtext\<CR>"
- endif
+ " somehow doesn't work on MS-Windows
+ CheckUnix
+ let cmd = "cat Xtext\<CR>"
let buf = term_start(&shell, {})
call writefile(["\<Esc>[?1047h"], 'Xtext')