diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-07-16 21:14:54 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-16 21:32:25 +0800 |
commit | bc73795a5858129a84d510f682c9dcb17aa1813a (patch) | |
tree | e046306d2b4a983e030be9a1d718c98494e289ee /src | |
parent | f7c6676199f222162dc4ec448857ac64faa26f87 (diff) | |
download | rneovim-bc73795a5858129a84d510f682c9dcb17aa1813a.tar.gz rneovim-bc73795a5858129a84d510f682c9dcb17aa1813a.tar.bz2 rneovim-bc73795a5858129a84d510f682c9dcb17aa1813a.zip |
vim-patch:8.2.0198: no tests for y/n prompt
Problem: No tests for y/n prompt.
Solution: Add tests. (Dominique Pelle, closes vim/vim#5564)
https://github.com/vim/vim/commit/43c60eda2aa22ba3d7aaf418cfbdb75f1a008e67
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/testdir/test_messages.vim | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_messages.vim b/src/nvim/testdir/test_messages.vim index 6954b4bc91..fb6c9c1554 100644 --- a/src/nvim/testdir/test_messages.vim +++ b/src/nvim/testdir/test_messages.vim @@ -203,7 +203,37 @@ func Test_message_more() call term_sendkeys(buf, 'q') call WaitForAssert({-> assert_equal('100', term_getline(buf, 5))}) - call term_sendkeys(buf, ':q!') + call term_sendkeys(buf, ":q!\n") + call StopVimInTerminal(buf) +endfunc + +func Test_ask_yesno() + if !CanRunVimInTerminal() + throw 'Skipped: cannot run vim in terminal' + endif + let buf = RunVimInTerminal('', {'rows': 6}) + call term_sendkeys(buf, ":call setline(1, range(1, 2))\n") + + call term_sendkeys(buf, ":2,1s/^/n/\n") + call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))}) + call term_sendkeys(buf, "n") + call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?n *1,1 *All$', term_getline(buf, 6))}) + call WaitForAssert({-> assert_equal('1', term_getline(buf, 1))}) + + call term_sendkeys(buf, ":2,1s/^/Esc/\n") + call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))}) + call term_sendkeys(buf, "\<Esc>") + call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?n *1,1 *All$', term_getline(buf, 6))}) + call WaitForAssert({-> assert_equal('1', term_getline(buf, 1))}) + + call term_sendkeys(buf, ":2,1s/^/y/\n") + call WaitForAssert({-> assert_equal('Backwards range given, OK to swap (y/n)?', term_getline(buf, 6))}) + call term_sendkeys(buf, "y") + call WaitForAssert({-> assert_match('^Backwards range given, OK to swap (y/n)?y *2,1 *All$', term_getline(buf, 6))}) + call WaitForAssert({-> assert_equal('y1', term_getline(buf, 1))}) + call WaitForAssert({-> assert_equal('y2', term_getline(buf, 2))}) + + call term_sendkeys(buf, ":q!\n") call StopVimInTerminal(buf) endfunc |