summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-03 20:59:40 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-03 20:59:40 +0200
commite88fc7a574263fd399c6815378bcd8fd228d8b54 (patch)
tree1a4c785391dd324a05ad0c9cd81e42a461f10e5e /src/testdir
parent9d654a8d8cd3421307445f111785fb303a38c2a0 (diff)
downloadvim-git-e88fc7a574263fd399c6815378bcd8fd228d8b54.tar.gz
patch 8.0.1052: term_start() does not allow in_io, out_io and err_io optionsv8.0.1052
Problem: term_start() does not allow in_io, out_io and err_io options. Solution: Add JO_OUT_IO to get_job_options().
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_terminal.vim48
1 files changed, 44 insertions, 4 deletions
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index ce3fab7e5..dce5f05cd 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -164,10 +164,8 @@ func Test_terminal_scrape_123()
call term_wait(1234)
call term_wait(buf)
- if has('win32')
- " TODO: this should not be needed
- sleep 100m
- endif
+ let g:buf = buf
+ call WaitFor('len(term_scrape(g:buf, 1)) > 0')
call Check_123(buf)
" Must still work after the job ended.
@@ -573,3 +571,45 @@ func Test_terminal_special_chars()
call delete('Xdir with spaces', 'rf')
bwipe
endfunc
+
+func Test_terminal_wrong_options()
+ call assert_fails('call term_start(&shell, {
+ \ "in_io": "file",
+ \ "in_name": "xxx",
+ \ "out_io": "file",
+ \ "out_name": "xxx",
+ \ "err_io": "file",
+ \ "err_name": "xxx"
+ \ })', 'E474:')
+ call assert_fails('call term_start(&shell, {
+ \ "out_buf": bufnr("%")
+ \ })', 'E474:')
+ call assert_fails('call term_start(&shell, {
+ \ "err_buf": bufnr("%")
+ \ })', 'E474:')
+endfunc
+
+func Test_terminal_redir_file()
+ let cmd = Get_cat_123_cmd()
+ let buf = term_start(cmd, {'out_io': 'file', 'out_name': 'Xfile'})
+ call term_wait(buf)
+ call WaitFor('len(readfile("Xfile")) > 0')
+ call assert_match('123', readfile('Xfile')[0])
+ call delete('Xfile')
+
+ if has('unix')
+ let buf = term_start('xyzabc', {'err_io': 'file', 'err_name': 'Xfile'})
+ call term_wait(buf)
+ call WaitFor('len(readfile("Xfile")) > 0')
+ call assert_match('executing job failed', readfile('Xfile')[0])
+ call delete('Xfile')
+
+ call writefile(['one line'], 'Xfile')
+ let buf = term_start('cat', {'in_io': 'file', 'in_name': 'Xfile'})
+ call term_wait(buf)
+ call WaitFor('term_getline(' . buf . ', 1) == "one line"')
+ call assert_equal('one line', term_getline(buf, 1))
+ bwipe
+ call delete('Xfile')
+ endif
+endfunc