summaryrefslogtreecommitdiff
path: root/src/testdir/test_terminal.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2017-09-02 17:18:35 +0200
committerBram Moolenaar <Bram@vim.org>2017-09-02 17:18:35 +0200
commitdada6d2a8e887309e88cb126f1251d81f91b4b9d (patch)
tree90b1f483ed53f0b6c5ab963c6becc1e1cd9887fd /src/testdir/test_terminal.vim
parentef68e4fa528165f8dd63156feeffc1af629b8d8a (diff)
downloadvim-dada6d2a8e887309e88cb126f1251d81f91b4b9d.zip
patch 8.0.1036: ++eof argument for terminal only available on MS-Windows
Problem: ++eof argument for terminal only available on MS-Windows. Solution: Also support ++eof on Unix. Add a test.
Diffstat (limited to 'src/testdir/test_terminal.vim')
-rw-r--r--src/testdir/test_terminal.vim31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim
index 573db1e01..c70b61295 100644
--- a/src/testdir/test_terminal.vim
+++ b/src/testdir/test_terminal.vim
@@ -490,24 +490,47 @@ endfunc
func Test_terminal_write_stdin()
if !executable('wc')
- call ch_log('Test_terminal_write_stdin() is skipped because system doesn''t have wc command')
- return
+ throw 'skipped: wc command not available'
endif
new
call setline(1, ['one', 'two', 'three'])
%term wc
- call WaitFor('getline(1) != ""')
+ call WaitFor('getline("$") =~ "3"')
let nrs = split(getline('$'))
call assert_equal(['3', '3', '14'], nrs)
bwipe
+ new
call setline(1, ['one', 'two', 'three', 'four'])
2,3term wc
- call WaitFor('getline(1) != ""')
+ call WaitFor('getline("$") =~ "2"')
let nrs = split(getline('$'))
call assert_equal(['2', '2', '10'], nrs)
bwipe
+ if executable('python')
+ new
+ call setline(1, ['print("hello")'])
+ 1term ++eof=exit() python
+ " MS-Windows echoes the input, Unix doesn't.
+ call WaitFor('getline("$") =~ "exit" || getline(1) =~ "hello"')
+ if getline(1) =~ 'hello'
+ call assert_equal('hello', getline(1))
+ else
+ call assert_equal('hello', getline(line('$') - 1))
+ endif
+ bwipe
+
+ if has('win32')
+ new
+ call setline(1, ['print("hello")'])
+ 1term ++eof=<C-Z> python
+ call WaitFor('getline("$") =~ "Z"')
+ call assert_equal('hello', getline(line('$') - 1))
+ bwipe
+ endif
+ endif
+
bwipe!
endfunc