Merge pull request #10202 from blueyed/vim-8.0.1704

vim-patch:8.0.1704: 'backupskip' default doesn't work for Mac

Also aligns tests from two previous patched to the ones in upstream.
This commit is contained in:
Daniel Hahler
2019-06-13 14:20:51 +02:00
committed by GitHub
3 changed files with 49 additions and 27 deletions

View File

@@ -874,7 +874,9 @@ A jump table for the options with a short description can be found at |Q_op|.
< Use 'backupdir' to put the backup in a different directory. < Use 'backupdir' to put the backup in a different directory.
*'backupskip'* *'bsk'* *'backupskip'* *'bsk'*
'backupskip' 'bsk' string (default: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*") 'backupskip' 'bsk' string (default: "$TMPDIR/*,$TMP/*,$TEMP/*"
Unix: "/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*"
Mac: "/private/tmp/*,$TMPDIR/*,$TMP/*,$TEMP/*")
global global
A list of file patterns. When one of the patterns matches with the A list of file patterns. When one of the patterns matches with the
name of the file which is written, no backup file is created. Both name of the file which is written, no backup file is created. Both

View File

@@ -626,7 +626,11 @@ void set_init_1(void)
char *p; char *p;
# ifdef UNIX # ifdef UNIX
if (*names[n] == NUL) { if (*names[n] == NUL) {
# ifdef __APPLE__
p = "/private/tmp";
# else
p = "/tmp"; p = "/tmp";
# endif
mustfree = false; mustfree = false;
} else } else
# endif # endif

View File

@@ -180,6 +180,15 @@ func Test_thesaurus()
call Check_dir_option('thesaurus') call Check_dir_option('thesaurus')
endfun endfun
func Test_complete()
" Trailing single backslash used to cause invalid memory access.
set complete=s\
new
call feedkeys("i\<C-N>\<Esc>", 'xt')
bwipe!
set complete&
endfun
func Test_set_completion() func Test_set_completion()
call feedkeys(":set di\<C-A>\<C-B>\"\<CR>", 'tx') call feedkeys(":set di\<C-A>\<C-B>\"\<CR>", 'tx')
call assert_equal('"set dictionary diff diffexpr diffopt digraph directory display', @:) call assert_equal('"set dictionary diff diffexpr diffopt digraph directory display', @:)
@@ -305,14 +314,23 @@ func Test_set_ttytype()
endif endif
endfunc endfunc
func Test_complete() func Test_set_all()
" Trailing single backslash used to cause invalid memory access. set tw=75
set complete=s\ set iskeyword=a-z,A-Z
new set nosplitbelow
call feedkeys("i\<C-N>\<Esc>", 'xt') let out = execute('set all')
bwipe! call assert_match('textwidth=75', out)
set complete& call assert_match('iskeyword=a-z,A-Z', out)
endfun call assert_match('nosplitbelow', out)
set tw& iskeyword& splitbelow&
endfunc
func Test_set_values()
" The file is only generated when running "make test" in the src directory.
if filereadable('opt_test.vim')
source opt_test.vim
endif
endfunc
func ResetIndentexpr() func ResetIndentexpr()
set indentexpr= set indentexpr=
@@ -327,6 +345,22 @@ func Test_set_indentexpr()
bwipe! bwipe!
endfunc endfunc
func Test_backupskip()
if has("mac")
call assert_match('/private/tmp/\*', &bsk)
elseif has("unix")
call assert_match('/tmp/\*', &bsk)
endif
let bskvalue = substitute(&bsk, '\\', '/', 'g')
for var in ['$TEMPDIR', '$TMP', '$TEMP']
if exists(var)
let varvalue = substitute(expand(var), '\\', '/', 'g')
call assert_match(varvalue . '.\*', bskvalue)
endif
endfor
endfunc
func Test_copy_winopt() func Test_copy_winopt()
set hidden set hidden
@@ -395,24 +429,6 @@ func Test_shortmess_F()
bwipe bwipe
endfunc endfunc
func Test_set_all()
set tw=75
set iskeyword=a-z,A-Z
set nosplitbelow
let out = execute('set all')
call assert_match('textwidth=75', out)
call assert_match('iskeyword=a-z,A-Z', out)
call assert_match('nosplitbelow', out)
set tw& iskeyword& splitbelow&
endfunc
func Test_set_values()
" The file is only generated when running "make test" in the src directory.
if filereadable('opt_test.vim')
source opt_test.vim
endif
endfunc
func Test_shortmess_F2() func Test_shortmess_F2()
e file1 e file1
e file2 e file2