changeset 16389:fb7cf38a1c7a v8.1.1199

patch 8.1.1199: no test for :abclear commit https://github.com/vim/vim/commit/8485be4e49ed6c157d7349920992643fd1ab5c3b Author: Bram Moolenaar <Bram@vim.org> Date: Tue Apr 23 16:36:05 2019 +0200 patch 8.1.1199: no test for :abclear Problem: No test for :abclear. Solution: Add a test. (Dominique Pelle, closes https://github.com/vim/vim/issues/4292)
author Bram Moolenaar <Bram@vim.org>
date Tue, 23 Apr 2019 16:45:04 +0200
parents a4101e185bbb
children 85514bc2b277
files src/testdir/test_mapping.vim src/version.c
diffstat 2 files changed, 58 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_mapping.vim
+++ b/src/testdir/test_mapping.vim
@@ -11,6 +11,62 @@ func Test_abbreviation()
   set nomodified
 endfunc
 
+func Test_abclear()
+   abbrev foo foobar
+   iabbrev fooi foobari
+   cabbrev fooc foobarc
+   call assert_equal("\n\n"
+         \        .. "c  fooc          foobarc\n"
+         \        .. "i  fooi          foobari\n"
+         \        .. "!  foo           foobar", execute('abbrev'))
+
+   iabclear
+   call assert_equal("\n\n"
+         \        .. "c  fooc          foobarc\n"
+         \        .. "c  foo           foobar", execute('abbrev'))
+   abbrev foo foobar
+   iabbrev fooi foobari
+
+   cabclear
+   call assert_equal("\n\n"
+         \        .. "i  fooi          foobari\n"
+         \        .. "i  foo           foobar", execute('abbrev'))
+   abbrev foo foobar
+   cabbrev fooc foobarc
+
+   abclear
+   call assert_equal("\n\nNo abbreviation found", execute('abbrev'))
+endfunc
+
+func Test_abclear_buffer()
+  abbrev foo foobar
+  new X1
+  abbrev <buffer> foo1 foobar1
+  new X2
+  abbrev <buffer> foo2 foobar2
+
+  call assert_equal("\n\n"
+        \        .. "!  foo2         @foobar2\n"
+        \        .. "!  foo           foobar", execute('abbrev'))
+
+  abclear <buffer>
+  call assert_equal("\n\n"
+        \        .. "!  foo           foobar", execute('abbrev'))
+
+  b X1
+  call assert_equal("\n\n"
+        \        .. "!  foo1         @foobar1\n"
+        \        .. "!  foo           foobar", execute('abbrev'))
+  abclear <buffer>
+  call assert_equal("\n\n"
+        \        .. "!  foo           foobar", execute('abbrev'))
+
+  abclear
+   call assert_equal("\n\nNo abbreviation found", execute('abbrev'))
+
+  %bwipe
+endfunc
+
 func Test_map_ctrl_c_insert()
   " mapping of ctrl-c in Insert mode
   set cpo-=< cpo-=k
--- a/src/version.c
+++ b/src/version.c
@@ -772,6 +772,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1199,
+/**/
     1198,
 /**/
     1197,