]> granicus.if.org Git - vim/commitdiff
patch 8.2.2520: missing tests for 'listchars' v8.2.2520
authorBram Moolenaar <Bram@vim.org>
Tue, 16 Feb 2021 20:14:33 +0000 (21:14 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 16 Feb 2021 20:14:33 +0000 (21:14 +0100)
Problem:    Missing tests for 'listchars'.
Solution:   Add a few more checks. (Yegappan Lakshmanan, closes #7854)

src/testdir/test_listchars.vim
src/version.c

index ca47d5283aadf88bc6f9809eb6cac7941ca76789..172407a8da513080f79e6eda1868d3fa7765e90d 100644 (file)
@@ -336,6 +336,26 @@ func Test_listchars_window_local()
   close
   call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
 
+  " Setting invalid value for a local setting should not impact the local and
+  " global settings
+  split
+  setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
+  let cmd = 'setlocal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x'
+  call assert_fails(cmd, 'E474:')
+  call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
+  close
+  call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
+
+  " Setting invalid value for a global setting should not impact the local and
+  " global settings
+  split
+  setlocal listchars=tab:<->,lead:_,space:.,trail:@,eol:#
+  let cmd = 'setglobal listchars=tab:{.},lead:-,space:=,trail:#,eol:$,x'
+  call assert_fails(cmd, 'E474:')
+  call assert_equal(['<------>__one..two@@#'], ScreenLines(1, virtcol('$')))
+  close
+  call assert_equal(['+------+^^one>>two<<%'], ScreenLines(1, virtcol('$')))
+
   %bw!
   set list& listchars&
 endfunc
index 02abac975277bf5117c1e7bf2ae68c597749f2cd..c1d89c04c1a4508cf0ae97acb255817770e7aae7 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2520,
 /**/
     2519,
 /**/