comparison 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
comparison
equal deleted inserted replaced
12312:754e3ee717e3 12313:44f3c9b7eec4
488 bwipe 488 bwipe
489 endfunc 489 endfunc
490 490
491 func Test_terminal_write_stdin() 491 func Test_terminal_write_stdin()
492 if !executable('wc') 492 if !executable('wc')
493 call ch_log('Test_terminal_write_stdin() is skipped because system doesn''t have wc command') 493 throw 'skipped: wc command not available'
494 return
495 endif 494 endif
496 new 495 new
497 call setline(1, ['one', 'two', 'three']) 496 call setline(1, ['one', 'two', 'three'])
498 %term wc 497 %term wc
499 call WaitFor('getline(1) != ""') 498 call WaitFor('getline("$") =~ "3"')
500 let nrs = split(getline('$')) 499 let nrs = split(getline('$'))
501 call assert_equal(['3', '3', '14'], nrs) 500 call assert_equal(['3', '3', '14'], nrs)
502 bwipe 501 bwipe
503 502
503 new
504 call setline(1, ['one', 'two', 'three', 'four']) 504 call setline(1, ['one', 'two', 'three', 'four'])
505 2,3term wc 505 2,3term wc
506 call WaitFor('getline(1) != ""') 506 call WaitFor('getline("$") =~ "2"')
507 let nrs = split(getline('$')) 507 let nrs = split(getline('$'))
508 call assert_equal(['2', '2', '10'], nrs) 508 call assert_equal(['2', '2', '10'], nrs)
509 bwipe 509 bwipe
510
511 if executable('python')
512 new
513 call setline(1, ['print("hello")'])
514 1term ++eof=exit() python
515 " MS-Windows echoes the input, Unix doesn't.
516 call WaitFor('getline("$") =~ "exit" || getline(1) =~ "hello"')
517 if getline(1) =~ 'hello'
518 call assert_equal('hello', getline(1))
519 else
520 call assert_equal('hello', getline(line('$') - 1))
521 endif
522 bwipe
523
524 if has('win32')
525 new
526 call setline(1, ['print("hello")'])
527 1term ++eof=<C-Z> python
528 call WaitFor('getline("$") =~ "Z"')
529 call assert_equal('hello', getline(line('$') - 1))
530 bwipe
531 endif
532 endif
510 533
511 bwipe! 534 bwipe!
512 endfunc 535 endfunc
513 536
514 func Test_terminal_no_cmd() 537 func Test_terminal_no_cmd()