comparison src/testdir/test_messages.vim @ 19279:25cb7ab433c6 v8.2.0198

patch 8.2.0198: no tests for y/n prompt Commit: https://github.com/vim/vim/commit/43c60eda2aa22ba3d7aaf418cfbdb75f1a008e67 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 2 15:55:19 2020 +0100 patch 8.2.0198: no tests for y/n prompt Problem: No tests for y/n prompt. Solution: Add tests. (Dominique Pelle, closes https://github.com/vim/vim/issues/5564)
author Bram Moolenaar <Bram@vim.org>
date Sun, 02 Feb 2020 16:00:09 +0100
parents 82410cbaa042
children c9cc9e5c87e0
comparison
equal deleted inserted replaced
19278:d5e4e5c9df1b 19279:25cb7ab433c6
263 263
264 " Stop command output with q, <Esc> or CTRL-C. 264 " Stop command output with q, <Esc> or CTRL-C.
265 call term_sendkeys(buf, 'q') 265 call term_sendkeys(buf, 'q')
266 call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))}) 266 call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))})
267 267
268 call term_sendkeys(buf, ':q!') 268 call term_sendkeys(buf, ":q!\n")
269 call StopVimInTerminal(buf)
270 endfunc
271
272 func Test_ask_yesno()
273 if !CanRunVimInTerminal()
274 throw 'Skipped: cannot run vim in terminal'
275 endif
276 let buf = RunVimInTerminal('', {'rows': 6})
277 call term_sendkeys(buf, ":call setline(1, range(1, 2))\n")
278
279 call term_sendkeys(buf, ":2,1s/^/n/\n")
280 call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))})
281 call term_sendkeys(buf, "n")
282 call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?n *1,1 *All$', term_getline(buf, 6))})
283 call WaitForAssert({-> assert_equal('1', term_getline(buf, 1))})
284
285 call term_sendkeys(buf, ":2,1s/^/Esc/\n")
286 call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))})
287 call term_sendkeys(buf, "\<Esc>")
288 call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?n *1,1 *All$', term_getline(buf, 6))})
289 call WaitForAssert({-> assert_equal('1', term_getline(buf, 1))})
290
291 call term_sendkeys(buf, ":2,1s/^/y/\n")
292 call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))})
293 call term_sendkeys(buf, "y")
294 call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?y *2,1 *All$', term_getline(buf, 6))})
295 call WaitForAssert({-> assert_equal('y1', term_getline(buf, 1))})
296 call WaitForAssert({-> assert_equal('y2', term_getline(buf, 2))})
297
298 call term_sendkeys(buf, ":q!\n")
269 call StopVimInTerminal(buf) 299 call StopVimInTerminal(buf)
270 endfunc 300 endfunc
271 301
272 func Test_null() 302 func Test_null()
273 echom test_null_list() 303 echom test_null_list()