Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
22233:0aeaeed4640d | 22234:b5abb88d5700 |
---|---|
1 " Test for options | 1 " Test for options |
2 | 2 |
3 source shared.vim | |
3 source check.vim | 4 source check.vim |
4 source view_util.vim | 5 source view_util.vim |
5 | 6 |
6 func Test_whichwrap() | 7 func Test_whichwrap() |
7 set whichwrap=b,s | 8 set whichwrap=b,s |
585 let found = (index(bsklist, varvalue) >= 0) | 586 let found = (index(bsklist, varvalue) >= 0) |
586 call assert_true(found, var . ' (' . varvalue . ') not in option bsk: ' . &bsk) | 587 call assert_true(found, var . ' (' . varvalue . ') not in option bsk: ' . &bsk) |
587 endif | 588 endif |
588 endfor | 589 endfor |
589 | 590 |
591 " Duplicates from environment variables should be filtered out (option has | |
592 " P_NODUP). Run this in a separate instance and write v:errors in a file, | |
593 " so that we see what happens on startup. | |
594 let after =<< trim [CODE] | |
595 let bsklist = split(&backupskip, ',') | |
596 call assert_equal(uniq(copy(bsklist)), bsklist) | |
597 call writefile(['errors:'] + v:errors, 'Xtestout') | |
598 qall | |
599 [CODE] | |
600 call writefile(after, 'Xafter') | |
601 let cmd = GetVimProg() . ' --not-a-term -S Xafter --cmd "set enc=utf8"' | |
602 | |
603 let saveenv = {} | |
604 for var in ['TMPDIR', 'TMP', 'TEMP'] | |
605 let saveenv[var] = getenv(var) | |
606 call setenv(var, '/duplicate/path') | |
607 endfor | |
608 | |
609 exe 'silent !' . cmd | |
610 call assert_equal(['errors:'], readfile('Xtestout')) | |
611 | |
612 " restore environment variables | |
613 for var in ['TMPDIR', 'TMP', 'TEMP'] | |
614 call setenv(var, saveenv[var]) | |
615 endfor | |
616 | |
617 call delete('Xtestout') | |
618 call delete('Xafter') | |
619 | |
590 " Duplicates should be filtered out (option has P_NODUP) | 620 " Duplicates should be filtered out (option has P_NODUP) |
591 let backupskip = &backupskip | 621 let backupskip = &backupskip |
592 set backupskip= | 622 set backupskip= |
593 set backupskip+=/test/dir | 623 set backupskip+=/test/dir |
594 set backupskip+=/other/dir | 624 set backupskip+=/other/dir |