Mercurial > vim
diff src/testdir/test_options.vim @ 22234:b5abb88d5700 v8.2.1666
patch 8.2.1666: the initial value of 'backupskip' can have duplicate items
Commit: https://github.com/vim/vim/commit/b00ef0508b22905379953a164bdb4300015d3705
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 12 14:53:53 2020 +0200
patch 8.2.1666: the initial value of 'backupskip' can have duplicate items
Problem: The initial value of 'backupskip' can have duplicate items.
Solution: Remove duplicates, like when it is set later. (Tom Ryder,
closes #6940)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 12 Sep 2020 15:00:04 +0200 |
parents | 30bdd2e4a6f9 |
children | 595ea7f099cd |
line wrap: on
line diff
--- a/src/testdir/test_options.vim +++ b/src/testdir/test_options.vim @@ -1,5 +1,6 @@ " Test for options +source shared.vim source check.vim source view_util.vim @@ -587,6 +588,35 @@ func Test_backupskip() endif endfor + " Duplicates from environment variables should be filtered out (option has + " P_NODUP). Run this in a separate instance and write v:errors in a file, + " so that we see what happens on startup. + let after =<< trim [CODE] + let bsklist = split(&backupskip, ',') + call assert_equal(uniq(copy(bsklist)), bsklist) + call writefile(['errors:'] + v:errors, 'Xtestout') + qall + [CODE] + call writefile(after, 'Xafter') + let cmd = GetVimProg() . ' --not-a-term -S Xafter --cmd "set enc=utf8"' + + let saveenv = {} + for var in ['TMPDIR', 'TMP', 'TEMP'] + let saveenv[var] = getenv(var) + call setenv(var, '/duplicate/path') + endfor + + exe 'silent !' . cmd + call assert_equal(['errors:'], readfile('Xtestout')) + + " restore environment variables + for var in ['TMPDIR', 'TMP', 'TEMP'] + call setenv(var, saveenv[var]) + endfor + + call delete('Xtestout') + call delete('Xafter') + " Duplicates should be filtered out (option has P_NODUP) let backupskip = &backupskip set backupskip=