summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-02 15:55:19 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-02 15:55:19 +0100
commit43c60eda2aa22ba3d7aaf418cfbdb75f1a008e67 (patch)
tree758f7ab626de0f75f2098294f8e49b96b51004a3
parentea3db914c0fa35797ad73f6d5bb3a4288d690065 (diff)
downloadvim-git-43c60eda2aa22ba3d7aaf418cfbdb75f1a008e67.tar.gz
patch 8.2.0198: no tests for y/n promptv8.2.0198
Problem: No tests for y/n prompt. Solution: Add tests. (Dominique Pelle, closes #5564)
-rw-r--r--src/testdir/test_messages.vim32
-rw-r--r--src/version.c2
2 files changed, 33 insertions, 1 deletions
diff --git a/src/testdir/test_messages.vim b/src/testdir/test_messages.vim
index 62a191ec8..2f8e2faf9 100644
--- a/src/testdir/test_messages.vim
+++ b/src/testdir/test_messages.vim
@@ -265,7 +265,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
diff --git a/src/version.c b/src/version.c
index 800d7e569..59db0095e 100644
--- a/src/version.c
+++ b/src/version.c
@@ -743,6 +743,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 198,
+/**/
197,
/**/
196,