Mercurial > vim
annotate src/testdir/test_writefile.vim @ 19862:846fbbacce3a v8.2.0487
patch 8.2.0487: Vim9: compiling not sufficiently tested
Commit: https://github.com/vim/vim/commit/bd5da371aafe5a2207065643502f4d1ff6b286c7
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Mar 31 23:13:10 2020 +0200
patch 8.2.0487: Vim9: compiling not sufficiently tested
Problem: Vim9: compiling not sufficiently tested.
Solution: Add more tests. Fix bug with PCALL.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 31 Mar 2020 23:15:04 +0200 |
parents | 1697a25328fd |
children | 2fb397573541 |
rev | line source |
---|---|
18386
105c6cf8b266
patch 8.1.2187: error for bad regexp even though regexp is not used
Bram Moolenaar <Bram@vim.org>
parents:
16869
diff
changeset
|
1 " Tests for the writefile() function and some :write commands. |
10068
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
2 |
19277
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
3 source check.vim |
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
4 |
11519
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
5 func Test_writefile() |
10068
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
6 let f = tempname() |
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
7 call writefile(["over","written"], f, "b") |
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
8 call writefile(["hello","world"], f, "b") |
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
9 call writefile(["!", "good"], f, "a") |
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
10 call writefile(["morning"], f, "ab") |
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
11 call writefile(["", "vimmers"], f, "ab") |
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
12 let l = readfile(f) |
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
13 call assert_equal("hello", l[0]) |
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
14 call assert_equal("world!", l[1]) |
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
15 call assert_equal("good", l[2]) |
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
16 call assert_equal("morning", l[3]) |
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
17 call assert_equal("vimmers", l[4]) |
c577c6a2e88b
commit https://github.com/vim/vim/commit/19a1669ffc796e30a83c5600f82f12ebf63a2261
Christian Brabandt <cb@256bit.org>
parents:
diff
changeset
|
18 call delete(f) |
19695
1697a25328fd
patch 8.2.0404: writefile() error does not give a hint
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
19 |
1697a25328fd
patch 8.2.0404: writefile() error does not give a hint
Bram Moolenaar <Bram@vim.org>
parents:
19425
diff
changeset
|
20 call assert_fails('call writefile("text", "Xfile")', 'E475: Invalid argument: writefile() first argument must be a List or a Blob') |
11519
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
21 endfunc |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
22 |
18386
105c6cf8b266
patch 8.1.2187: error for bad regexp even though regexp is not used
Bram Moolenaar <Bram@vim.org>
parents:
16869
diff
changeset
|
23 func Test_writefile_ignore_regexp_error() |
105c6cf8b266
patch 8.1.2187: error for bad regexp even though regexp is not used
Bram Moolenaar <Bram@vim.org>
parents:
16869
diff
changeset
|
24 write Xt[z-a]est.txt |
105c6cf8b266
patch 8.1.2187: error for bad regexp even though regexp is not used
Bram Moolenaar <Bram@vim.org>
parents:
16869
diff
changeset
|
25 call delete('Xt[z-a]est.txt') |
105c6cf8b266
patch 8.1.2187: error for bad regexp even though regexp is not used
Bram Moolenaar <Bram@vim.org>
parents:
16869
diff
changeset
|
26 endfunc |
105c6cf8b266
patch 8.1.2187: error for bad regexp even though regexp is not used
Bram Moolenaar <Bram@vim.org>
parents:
16869
diff
changeset
|
27 |
11519
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
28 func Test_writefile_fails_gently() |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
29 call assert_fails('call writefile(["test"], "Xfile", [])', 'E730:') |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
30 call assert_false(filereadable("Xfile")) |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
31 call delete("Xfile") |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
32 |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
33 call assert_fails('call writefile(["test", [], [], [], "tset"], "Xfile")', 'E730:') |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
34 call assert_false(filereadable("Xfile")) |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
35 call delete("Xfile") |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
36 |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
37 call assert_fails('call writefile([], "Xfile", [])', 'E730:') |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
38 call assert_false(filereadable("Xfile")) |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
39 call delete("Xfile") |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
40 |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
41 call assert_fails('call writefile([], [])', 'E730:') |
4a1f7849fe86
patch 8.0.0642: writefile() continues after detecting an error
Christian Brabandt <cb@256bit.org>
parents:
10068
diff
changeset
|
42 endfunc |
11605
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
43 |
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
44 func Test_writefile_fails_conversion() |
15677
772e72b046a3
patch 8.1.0846: not easy to recognize the system Vim runs on
Bram Moolenaar <Bram@vim.org>
parents:
15607
diff
changeset
|
45 if !has('iconv') || has('sun') |
11605
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
46 return |
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
47 endif |
16694
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
48 " Without a backup file the write won't happen if there is a conversion |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
49 " error. |
16869
e264d45f268a
patch 8.1.1436: writefile test fails when run under /tmp
Bram Moolenaar <Bram@vim.org>
parents:
16694
diff
changeset
|
50 set nobackup nowritebackup backupdir=. backupskip= |
11605
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
51 new |
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
52 let contents = ["line one", "line two"] |
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
53 call writefile(contents, 'Xfile') |
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
54 edit Xfile |
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
55 call setline(1, ["first line", "cannot convert \u010b", "third line"]) |
16694
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
56 call assert_fails('write ++enc=cp932', 'E513:') |
11605
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
57 call assert_equal(contents, readfile('Xfile')) |
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
58 |
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
59 call delete('Xfile') |
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
60 bwipe! |
16869
e264d45f268a
patch 8.1.1436: writefile test fails when run under /tmp
Bram Moolenaar <Bram@vim.org>
parents:
16694
diff
changeset
|
61 set backup& writebackup& backupdir&vim backupskip&vim |
11605
16ccaedce025
patch 8.0.0685: when conversion fails written file may be truncated
Christian Brabandt <cb@256bit.org>
parents:
11519
diff
changeset
|
62 endfunc |
12624
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
63 |
16694
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
64 func Test_writefile_fails_conversion2() |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
65 if !has('iconv') || has('sun') |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
66 return |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
67 endif |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
68 " With a backup file the write happens even if there is a conversion error, |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
69 " but then the backup file must remain |
16869
e264d45f268a
patch 8.1.1436: writefile test fails when run under /tmp
Bram Moolenaar <Bram@vim.org>
parents:
16694
diff
changeset
|
70 set nobackup writebackup backupdir=. backupskip= |
16694
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
71 let contents = ["line one", "line two"] |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
72 call writefile(contents, 'Xfile_conversion_err') |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
73 edit Xfile_conversion_err |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
74 call setline(1, ["first line", "cannot convert \u010b", "third line"]) |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
75 set fileencoding=latin1 |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
76 let output = execute('write') |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
77 call assert_match('CONVERSION ERROR', output) |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
78 call assert_equal(contents, readfile('Xfile_conversion_err~')) |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
79 |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
80 call delete('Xfile_conversion_err') |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
81 call delete('Xfile_conversion_err~') |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
82 bwipe! |
16869
e264d45f268a
patch 8.1.1436: writefile test fails when run under /tmp
Bram Moolenaar <Bram@vim.org>
parents:
16694
diff
changeset
|
83 set backup& writebackup& backupdir&vim backupskip&vim |
16694
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
84 endfunc |
ed9b15758241
patch 8.1.1349: if writing runs into conversion error backup file is deleted
Bram Moolenaar <Bram@vim.org>
parents:
15677
diff
changeset
|
85 |
12624
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
86 func SetFlag(timer) |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
87 let g:flag = 1 |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
88 endfunc |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
89 |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
90 func Test_write_quit_split() |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
91 " Prevent exiting by splitting window on file write. |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
92 augroup testgroup |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
93 autocmd BufWritePre * split |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
94 augroup END |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
95 e! Xfile |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
96 call setline(1, 'nothing') |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
97 wq |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
98 |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
99 if has('timers') |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
100 " timer will not run if "exiting" is still set |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
101 let g:flag = 0 |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
102 call timer_start(1, 'SetFlag') |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
103 sleep 50m |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
104 call assert_equal(1, g:flag) |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
105 unlet g:flag |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
106 endif |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
107 au! testgroup |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
108 bwipe Xfile |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
109 call delete('Xfile') |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
110 endfunc |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
111 |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
112 func Test_nowrite_quit_split() |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
113 " Prevent exiting by opening a help window. |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
114 e! Xfile |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
115 help |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
116 wincmd w |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
117 exe winnr() . 'q' |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
118 |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
119 if has('timers') |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
120 " timer will not run if "exiting" is still set |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
121 let g:flag = 0 |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
122 call timer_start(1, 'SetFlag') |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
123 sleep 50m |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
124 call assert_equal(1, g:flag) |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
125 unlet g:flag |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
126 endif |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
127 bwipe Xfile |
ae2802b6bf7d
patch 8.0.1190: unusable after opening new window in BufWritePre event
Christian Brabandt <cb@256bit.org>
parents:
11605
diff
changeset
|
128 endfunc |
12857
ffdf2e4b5d9a
patch 8.0.1305: writefile() never calls fsync()
Christian Brabandt <cb@256bit.org>
parents:
12624
diff
changeset
|
129 |
ffdf2e4b5d9a
patch 8.0.1305: writefile() never calls fsync()
Christian Brabandt <cb@256bit.org>
parents:
12624
diff
changeset
|
130 func Test_writefile_sync_arg() |
ffdf2e4b5d9a
patch 8.0.1305: writefile() never calls fsync()
Christian Brabandt <cb@256bit.org>
parents:
12624
diff
changeset
|
131 " This doesn't check if fsync() works, only that the argument is accepted. |
ffdf2e4b5d9a
patch 8.0.1305: writefile() never calls fsync()
Christian Brabandt <cb@256bit.org>
parents:
12624
diff
changeset
|
132 call writefile(['one'], 'Xtest', 's') |
ffdf2e4b5d9a
patch 8.0.1305: writefile() never calls fsync()
Christian Brabandt <cb@256bit.org>
parents:
12624
diff
changeset
|
133 call writefile(['two'], 'Xtest', 'S') |
ffdf2e4b5d9a
patch 8.0.1305: writefile() never calls fsync()
Christian Brabandt <cb@256bit.org>
parents:
12624
diff
changeset
|
134 call delete('Xtest') |
ffdf2e4b5d9a
patch 8.0.1305: writefile() never calls fsync()
Christian Brabandt <cb@256bit.org>
parents:
12624
diff
changeset
|
135 endfunc |
12926
98503d690368
patch 8.0.1339: no test for what 8.0.1335 fixes
Christian Brabandt <cb@256bit.org>
parents:
12857
diff
changeset
|
136 |
98503d690368
patch 8.0.1339: no test for what 8.0.1335 fixes
Christian Brabandt <cb@256bit.org>
parents:
12857
diff
changeset
|
137 func Test_writefile_sync_dev_stdout() |
98503d690368
patch 8.0.1339: no test for what 8.0.1335 fixes
Christian Brabandt <cb@256bit.org>
parents:
12857
diff
changeset
|
138 if !has('unix') |
98503d690368
patch 8.0.1339: no test for what 8.0.1335 fixes
Christian Brabandt <cb@256bit.org>
parents:
12857
diff
changeset
|
139 return |
98503d690368
patch 8.0.1339: no test for what 8.0.1335 fixes
Christian Brabandt <cb@256bit.org>
parents:
12857
diff
changeset
|
140 endif |
13744
d6553cde1292
patch 8.0.1744: on some systems /dev/stdout isn't writable
Christian Brabandt <cb@256bit.org>
parents:
12926
diff
changeset
|
141 if filewritable('/dev/stdout') |
d6553cde1292
patch 8.0.1744: on some systems /dev/stdout isn't writable
Christian Brabandt <cb@256bit.org>
parents:
12926
diff
changeset
|
142 " Just check that this doesn't cause an error. |
d6553cde1292
patch 8.0.1744: on some systems /dev/stdout isn't writable
Christian Brabandt <cb@256bit.org>
parents:
12926
diff
changeset
|
143 call writefile(['one'], '/dev/stdout') |
d6553cde1292
patch 8.0.1744: on some systems /dev/stdout isn't writable
Christian Brabandt <cb@256bit.org>
parents:
12926
diff
changeset
|
144 else |
d6553cde1292
patch 8.0.1744: on some systems /dev/stdout isn't writable
Christian Brabandt <cb@256bit.org>
parents:
12926
diff
changeset
|
145 throw 'Skipped: /dev/stdout is not writable' |
d6553cde1292
patch 8.0.1744: on some systems /dev/stdout isn't writable
Christian Brabandt <cb@256bit.org>
parents:
12926
diff
changeset
|
146 endif |
12926
98503d690368
patch 8.0.1339: no test for what 8.0.1335 fixes
Christian Brabandt <cb@256bit.org>
parents:
12857
diff
changeset
|
147 endfunc |
14642
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
148 |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
149 func Test_writefile_autowrite() |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
150 set autowrite |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
151 new |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
152 next Xa Xb Xc |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
153 call setline(1, 'aaa') |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
154 next |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
155 call assert_equal(['aaa'], readfile('Xa')) |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
156 call setline(1, 'bbb') |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
157 call assert_fails('edit XX') |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
158 call assert_false(filereadable('Xb')) |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
159 |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
160 set autowriteall |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
161 edit XX |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
162 call assert_equal(['bbb'], readfile('Xb')) |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
163 |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
164 bwipe! |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
165 call delete('Xa') |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
166 call delete('Xb') |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
167 set noautowrite |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
168 endfunc |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
169 |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
170 func Test_writefile_autowrite_nowrite() |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
171 set autowrite |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
172 new |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
173 next Xa Xb Xc |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
174 set buftype=nowrite |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
175 call setline(1, 'aaa') |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
176 let buf = bufnr('%') |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
177 " buffer contents silently lost |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
178 edit XX |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
179 call assert_false(filereadable('Xa')) |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
180 rewind |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
181 call assert_equal('', getline(1)) |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
182 |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
183 bwipe! |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
184 set noautowrite |
96858d612aff
patch 8.1.0334: 'autowrite' takes effect when buffer is not to be written
Christian Brabandt <cb@256bit.org>
parents:
13744
diff
changeset
|
185 endfunc |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
186 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
187 " Test for ':w !<cmd>' to pipe lines from the current buffer to an external |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
188 " command. |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
189 func Test_write_pipe_to_cmd() |
19277
1b02482e6a61
patch 8.2.0197: some Ex commands not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents:
19231
diff
changeset
|
190 CheckUnix |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
191 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
192 call setline(1, ['L1', 'L2', 'L3', 'L4']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
193 2,3w !cat > Xfile |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
194 call assert_equal(['L2', 'L3'], readfile('Xfile')) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
195 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
196 call delete('Xfile') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
197 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
198 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
199 " Test for :saveas |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
200 func Test_saveas() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
201 call assert_fails('saveas', 'E471:') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
202 call writefile(['L1'], 'Xfile') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
203 new Xfile |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
204 new |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
205 call setline(1, ['L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
206 call assert_fails('saveas Xfile', 'E139:') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
207 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
208 enew | only |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
209 call delete('Xfile') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
210 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
211 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
212 func Test_write_errors() |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
213 " Test for writing partial buffer |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
214 call writefile(['L1', 'L2', 'L3'], 'Xfile') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
215 new Xfile |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
216 call assert_fails('1,2write', 'E140:') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
217 close! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
218 |
19384
6c944fee0d7e
patch 8.2.0250: test_clear_search_pat() is unused
Bram Moolenaar <Bram@vim.org>
parents:
19277
diff
changeset
|
219 call assert_fails('w > Xtest', 'E494:') |
19425
67fbe280a502
patch 8.2.0270: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19384
diff
changeset
|
220 |
19231
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
221 " Try to overwrite a directory |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
222 if has('unix') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
223 call mkdir('Xdir1') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
224 call assert_fails('write Xdir1', 'E17:') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
225 call delete('Xdir1', 'd') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
226 endif |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
227 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
228 " Test for :wall for a buffer with no name |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
229 enew | only |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
230 call setline(1, ['L1']) |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
231 call assert_fails('wall', 'E141:') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
232 enew! |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
233 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
234 " Test for writing a 'readonly' file |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
235 new Xfile |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
236 set readonly |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
237 call assert_fails('write', 'E45:') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
238 close |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
239 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
240 " Test for writing to a read-only file |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
241 new Xfile |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
242 call setfperm('Xfile', 'r--r--r--') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
243 call assert_fails('write', 'E505:') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
244 call setfperm('Xfile', 'rw-rw-rw-') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
245 close |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
246 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
247 call delete('Xfile') |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
248 endfunc |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
249 |
b8fd7364befd
patch 8.2.0174: various commands not completely tested
Bram Moolenaar <Bram@vim.org>
parents:
18386
diff
changeset
|
250 " vim: shiftwidth=2 sts=2 expandtab |