Mercurial > vim
diff src/testdir/test_terminal.vim @ 12415:cd66083e371e v8.0.1087
patch 8.0.1087: Test_terminal_cwd is flaky
commit https://github.com/vim/vim/commit/e9f6fd27d0e2dcae3f4aa40c459d5e6a3b3dd102
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 10 14:25:49 2017 +0200
patch 8.0.1087: Test_terminal_cwd is flaky
Problem: Test_terminal_cwd is flaky. MS-Windows: term_start() "cwd"
argument does not work.
Solution: Wait for the condition to be true instead of using a sleep.
Pass the directory to winpty.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 10 Sep 2017 14:30:03 +0200 |
parents | e9dbdc4d8279 |
children | 4ae1485b5834 |
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -396,14 +396,13 @@ func Test_finish_open_close() endfunc func Test_terminal_cwd() - if !has('unix') + if !executable('pwd') return endif call mkdir('Xdir') let buf = term_start('pwd', {'cwd': 'Xdir'}) - sleep 100m - call term_wait(buf) - call assert_equal(getcwd() . '/Xdir', getline(1)) + call WaitFor('"Xdir" == fnamemodify(getline(1), ":t")') + call assert_equal('Xdir', fnamemodify(getline(1), ":t")) exe buf . 'bwipe' call delete('Xdir', 'rf') @@ -603,6 +602,8 @@ func Test_terminal_redir_file() call term_wait(buf) call WaitFor('len(readfile("Xfile")) > 0') call assert_match('123', readfile('Xfile')[0]) + let g:job = term_getjob(buf) + call WaitFor('job_status(g:job) == "dead"') call delete('Xfile') bwipe endif