Mercurial > vim
comparison src/testdir/test_excmd.vim @ 19799:bde8020fb283 v8.2.0456
patch 8.2.0456: Test_confirm_cmd is flaky
Commit: https://github.com/vim/vim/commit/72749f062f15c7147f512bc581695c25ad78fb4e
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 26 20:51:43 2020 +0100
patch 8.2.0456: Test_confirm_cmd is flaky
Problem: Test_confirm_cmd is flaky.
Solution: Add a term_wait() call. (closes https://github.com/vim/vim/issues/5854)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 26 Mar 2020 21:00:04 +0100 |
parents | c9cc9e5c87e0 |
children | 71911b1dc3f9 |
comparison
equal
deleted
inserted
replaced
19798:ab0a91ba7a13 | 19799:bde8020fb283 |
---|---|
240 call StopVimInTerminal(buf) | 240 call StopVimInTerminal(buf) |
241 | 241 |
242 call assert_equal(['foo4'], readfile('foo')) | 242 call assert_equal(['foo4'], readfile('foo')) |
243 call assert_equal(['bar2'], readfile('bar')) | 243 call assert_equal(['bar2'], readfile('bar')) |
244 | 244 |
245 call delete('foo') | |
246 call delete('bar') | |
247 endfunc | |
248 | |
249 func Test_confirm_cmd_cancel() | |
245 " Test for closing a window with a modified buffer | 250 " Test for closing a window with a modified buffer |
246 let buf = RunVimInTerminal('', {'rows': 20}) | 251 let buf = RunVimInTerminal('', {'rows': 20}) |
247 call term_sendkeys(buf, ":set nomore\n") | 252 call term_sendkeys(buf, ":set nomore\n") |
248 call term_sendkeys(buf, ":new\n") | 253 call term_sendkeys(buf, ":new\n") |
249 call term_sendkeys(buf, ":call setline(1, 'abc')\n") | 254 call term_sendkeys(buf, ":call setline(1, 'abc')\n") |
250 call term_sendkeys(buf, ":confirm close\n") | 255 call term_sendkeys(buf, ":confirm close\n") |
251 call WaitForAssert({-> assert_match('^\[Y\]es, (N)o, (C)ancel: *$', | 256 call WaitForAssert({-> assert_match('^\[Y\]es, (N)o, (C)ancel: *$', |
252 \ term_getline(buf, 20))}, 1000) | 257 \ term_getline(buf, 20))}, 1000) |
253 call term_sendkeys(buf, "C") | 258 call term_sendkeys(buf, "C") |
259 call term_wait(buf, 50) | |
254 call term_sendkeys(buf, ":confirm close\n") | 260 call term_sendkeys(buf, ":confirm close\n") |
255 call WaitForAssert({-> assert_match('^\[Y\]es, (N)o, (C)ancel: *$', | 261 call WaitForAssert({-> assert_match('^\[Y\]es, (N)o, (C)ancel: *$', |
256 \ term_getline(buf, 20))}, 1000) | 262 \ term_getline(buf, 20))}, 1000) |
257 call term_sendkeys(buf, "N") | 263 call term_sendkeys(buf, "N") |
258 call StopVimInTerminal(buf) | 264 call StopVimInTerminal(buf) |
259 | |
260 call delete('foo') | |
261 call delete('bar') | |
262 endfunc | 265 endfunc |
263 | 266 |
264 " Test for the :print command | 267 " Test for the :print command |
265 func Test_print_cmd() | 268 func Test_print_cmd() |
266 call assert_fails('print', 'E749:') | 269 call assert_fails('print', 'E749:') |