diff src/testdir/test_terminal.vim @ 12313:44f3c9b7eec4 v8.0.1036

patch 8.0.1036: ++eof argument for terminal only available on MS-Windows commit https://github.com/vim/vim/commit/dada6d2a8e887309e88cb126f1251d81f91b4b9d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 2 17:18:35 2017 +0200 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.
author Christian Brabandt <cb@256bit.org>
date Sat, 02 Sep 2017 17:30:03 +0200
parents e1f44e4afe67
children 040ec95b8647
line wrap: on
line diff
--- 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