comparison src/testdir/test_writefile.vim @ 16869:e264d45f268a v8.1.1436

patch 8.1.1436: writefile test fails when run under /tmp commit https://github.com/vim/vim/commit/c28cb5b16df76353a5995fda3b9341612b8630c1 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 31 20:42:09 2019 +0200 patch 8.1.1436: writefile test fails when run under /tmp Problem: Writefile test fails when run under /tmp. Solution: Adjust 'backupskip. (Kenta Sato, closes https://github.com/vim/vim/issues/4462)
author Bram Moolenaar <Bram@vim.org>
date Fri, 31 May 2019 20:45:04 +0200
parents ed9b15758241
children 105c6cf8b266
comparison
equal deleted inserted replaced
16868:8c7ee13ffe4a 16869:e264d45f268a
36 if !has('iconv') || has('sun') 36 if !has('iconv') || has('sun')
37 return 37 return
38 endif 38 endif
39 " Without a backup file the write won't happen if there is a conversion 39 " Without a backup file the write won't happen if there is a conversion
40 " error. 40 " error.
41 set nobackup nowritebackup 41 set nobackup nowritebackup backupdir=. backupskip=
42 new 42 new
43 let contents = ["line one", "line two"] 43 let contents = ["line one", "line two"]
44 call writefile(contents, 'Xfile') 44 call writefile(contents, 'Xfile')
45 edit Xfile 45 edit Xfile
46 call setline(1, ["first line", "cannot convert \u010b", "third line"]) 46 call setline(1, ["first line", "cannot convert \u010b", "third line"])
47 call assert_fails('write ++enc=cp932', 'E513:') 47 call assert_fails('write ++enc=cp932', 'E513:')
48 call assert_equal(contents, readfile('Xfile')) 48 call assert_equal(contents, readfile('Xfile'))
49 49
50 call delete('Xfile') 50 call delete('Xfile')
51 bwipe! 51 bwipe!
52 set backup& writebackup& 52 set backup& writebackup& backupdir&vim backupskip&vim
53 endfunc 53 endfunc
54 54
55 func Test_writefile_fails_conversion2() 55 func Test_writefile_fails_conversion2()
56 if !has('iconv') || has('sun') 56 if !has('iconv') || has('sun')
57 return 57 return
58 endif 58 endif
59 " With a backup file the write happens even if there is a conversion error, 59 " With a backup file the write happens even if there is a conversion error,
60 " but then the backup file must remain 60 " but then the backup file must remain
61 set nobackup writebackup 61 set nobackup writebackup backupdir=. backupskip=
62 let contents = ["line one", "line two"] 62 let contents = ["line one", "line two"]
63 call writefile(contents, 'Xfile_conversion_err') 63 call writefile(contents, 'Xfile_conversion_err')
64 edit Xfile_conversion_err 64 edit Xfile_conversion_err
65 call setline(1, ["first line", "cannot convert \u010b", "third line"]) 65 call setline(1, ["first line", "cannot convert \u010b", "third line"])
66 set fileencoding=latin1 66 set fileencoding=latin1
69 call assert_equal(contents, readfile('Xfile_conversion_err~')) 69 call assert_equal(contents, readfile('Xfile_conversion_err~'))
70 70
71 call delete('Xfile_conversion_err') 71 call delete('Xfile_conversion_err')
72 call delete('Xfile_conversion_err~') 72 call delete('Xfile_conversion_err~')
73 bwipe! 73 bwipe!
74 set backup& writebackup& backupdir&vim backupskip&vim
74 endfunc 75 endfunc
75 76
76 func SetFlag(timer) 77 func SetFlag(timer)
77 let g:flag = 1 78 let g:flag = 1
78 endfunc 79 endfunc