changeset 23956:4d88e660ce32 v8.2.2520

patch 8.2.2520: missing tests for 'listchars' Commit: https://github.com/vim/vim/commit/04ea7e9049706788179945e2a91922c0b7cb9ed0 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Feb 16 21:14:33 2021 +0100 patch 8.2.2520: missing tests for 'listchars' Problem: Missing tests for 'listchars'. Solution: Add a few more checks. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/7854)
author Bram Moolenaar <Bram@vim.org>
date Tue, 16 Feb 2021 21:15:04 +0100
parents d7f49f279146
children dcac28f688ab
files src/testdir/test_listchars.vim src/version.c
diffstat 2 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_listchars.vim
+++ b/src/testdir/test_listchars.vim
@@ -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
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2520,
+/**/
     2519,
 /**/
     2518,