annotate src/testdir/test_filechanged.vim @ 27635:6ca2d8f4cd32 v8.2.4343

patch 8.2.4343: when reloading not all properties are detected Commit: https://github.com/vim/vim/commit/8196e94a8b72ed8618605cb66615571313097d78 Author: Rob Pilling <robpilling@gmail.com> Date: Fri Feb 11 15:12:10 2022 +0000 patch 8.2.4343: when reloading not all properties are detected Problem: When reloading not all properties are detected. Solution: Add the "edit" value to v:fcs_choice. (Rob Pilling, closes https://github.com/vim/vim/issues/9579)
author Bram Moolenaar <Bram@vim.org>
date Fri, 11 Feb 2022 16:15:03 +0100
parents 1725bb56178a
children 9bc9970e72eb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15615
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 " Tests for when a file was changed outside of Vim.
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 16754
diff changeset
3 source check.vim
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 16754
diff changeset
4
15615
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 func Test_FileChangedShell_reload()
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 16754
diff changeset
6 CheckUnix
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 16754
diff changeset
7
15615
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 augroup testreload
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9 au FileChangedShell Xchanged_r let g:reason = v:fcs_reason | let v:fcs_choice = 'reload'
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 augroup END
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 new Xchanged_r
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 call setline(1, 'reload this')
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 write
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 " Need to wait until the timestamp would change by at least a second.
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 sleep 2
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 silent !echo 'extra line' >>Xchanged_r
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 checktime
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 call assert_equal('changed', g:reason)
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 call assert_equal(2, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 call assert_equal('extra line', getline(2))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 " Only triggers once
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 let g:reason = ''
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 checktime
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 call assert_equal('', g:reason)
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 " When deleted buffer is not reloaded
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 silent !rm Xchanged_r
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 let g:reason = ''
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 checktime
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 call assert_equal('deleted', g:reason)
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 call assert_equal(2, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 call assert_equal('extra line', getline(2))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 " When recreated buffer is reloaded
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 call setline(1, 'buffer is changed')
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 silent !echo 'new line' >>Xchanged_r
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 let g:reason = ''
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 checktime
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 call assert_equal('conflict', g:reason)
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 call assert_equal(1, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 call assert_equal('new line', getline(1))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 " Only mode changed
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 silent !chmod +x Xchanged_r
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 let g:reason = ''
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 checktime
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 call assert_equal('mode', g:reason)
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 call assert_equal(1, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 call assert_equal('new line', getline(1))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 " Only time changed
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 sleep 2
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 silent !touch Xchanged_r
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 let g:reason = ''
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 checktime
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 call assert_equal('time', g:reason)
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 call assert_equal(1, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 call assert_equal('new line', getline(1))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 if has('persistent_undo')
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 " With an undo file the reload can be undone and a change before the
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 " reload.
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 set undofile
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 call setline(2, 'before write')
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 write
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 call setline(2, 'after write')
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 sleep 2
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 silent !echo 'different line' >>Xchanged_r
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 let g:reason = ''
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 checktime
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 call assert_equal('conflict', g:reason)
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 call assert_equal(3, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 call assert_equal('before write', getline(2))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 call assert_equal('different line', getline(3))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 " undo the reload
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77 undo
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 call assert_equal(2, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 call assert_equal('after write', getline(2))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 " undo the change before reload
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 undo
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 call assert_equal(2, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 call assert_equal('before write', getline(2))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 set noundofile
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 endif
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 au! testreload
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 bwipe!
16358
1a441c73adbc patch 8.1.1184: undo file left behind after running test
Bram Moolenaar <Bram@vim.org>
parents: 15625
diff changeset
90 call delete(undofile('Xchanged_r'))
15615
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 call delete('Xchanged_r')
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 endfunc
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93
27635
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
94 func Test_FileChangedShell_edit()
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
95 CheckUnix
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
96
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
97 new Xchanged_r
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
98 call setline(1, 'reload this')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
99 set fileformat=unix
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
100 write
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
101
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
102 " File format changed, reload (content only, no 'ff' etc)
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
103 augroup testreload
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
104 au!
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
105 au FileChangedShell Xchanged_r let g:reason = v:fcs_reason | let v:fcs_choice = 'reload'
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
106 augroup END
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
107 call assert_equal(&fileformat, 'unix')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
108 call writefile(["line1\r", "line2\r"], 'Xchanged_r')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
109 let g:reason = ''
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
110 checktime
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
111 call assert_equal('changed', g:reason)
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
112 call assert_equal(&fileformat, 'unix')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
113 call assert_equal("line1\r", getline(1))
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
114 call assert_equal("line2\r", getline(2))
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
115 %s/\r
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
116 write
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
117
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
118 " File format changed, reload with 'ff', etc
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
119 augroup testreload
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
120 au!
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
121 au FileChangedShell Xchanged_r let g:reason = v:fcs_reason | let v:fcs_choice = 'edit'
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
122 augroup END
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
123 call assert_equal(&fileformat, 'unix')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
124 call writefile(["line1\r", "line2\r"], 'Xchanged_r')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
125 let g:reason = ''
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
126 checktime
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
127 call assert_equal('changed', g:reason)
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
128 call assert_equal(&fileformat, 'dos')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
129 call assert_equal('line1', getline(1))
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
130 call assert_equal('line2', getline(2))
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
131 set fileformat=unix
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
132 write
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
133
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
134 au! testreload
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
135 bwipe!
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
136 call delete(undofile('Xchanged_r'))
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
137 call delete('Xchanged_r')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
138 endfunc
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
139
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
140 func Test_FileChangedShell_edit_dialog()
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
141 CheckNotGui
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
142
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
143 new Xchanged_r
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
144 call setline(1, 'reload this')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
145 set fileformat=unix
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
146 write
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
147
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
148 " File format changed, reload (content only) via prompt
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
149 augroup testreload
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
150 au!
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
151 au FileChangedShell Xchanged_r let g:reason = v:fcs_reason | let v:fcs_choice = 'ask'
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
152 augroup END
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
153 call assert_equal(&fileformat, 'unix')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
154 call writefile(["line1\r", "line2\r"], 'Xchanged_r')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
155 let g:reason = ''
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
156 call feedkeys('L', 'L') " load file content only
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
157 checktime
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
158 call assert_equal('changed', g:reason)
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
159 call assert_equal(&fileformat, 'unix')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
160 call assert_equal("line1\r", getline(1))
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
161 call assert_equal("line2\r", getline(2))
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
162 %s/\r
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
163 write
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
164
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
165 " File format changed, reload (file and options) via prompt
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
166 augroup testreload
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
167 au!
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
168 au FileChangedShell Xchanged_r let g:reason = v:fcs_reason | let v:fcs_choice = 'ask'
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
169 augroup END
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
170 call assert_equal(&fileformat, 'unix')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
171 call writefile(["line1\r", "line2\r"], 'Xchanged_r')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
172 let g:reason = ''
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
173 call feedkeys('a', 'L') " load file content and options
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
174 checktime
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
175 call assert_equal('changed', g:reason)
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
176 call assert_equal(&fileformat, 'dos')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
177 call assert_equal("line1", getline(1))
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
178 call assert_equal("line2", getline(2))
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
179 set fileformat=unix
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
180 write
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
181
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
182 au! testreload
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
183 bwipe!
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
184 call delete(undofile('Xchanged_r'))
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
185 call delete('Xchanged_r')
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
186 endfunc
6ca2d8f4cd32 patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents: 20861
diff changeset
187
15615
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 func Test_file_changed_dialog()
17657
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 16754
diff changeset
189 CheckUnix
0da9bc55c31a patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents: 16754
diff changeset
190 CheckNotGui
15615
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 au! FileChangedShell
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 new Xchanged_d
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 call setline(1, 'reload this')
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195 write
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 " Need to wait until the timestamp would change by at least a second.
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 sleep 2
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 silent !echo 'extra line' >>Xchanged_d
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 call feedkeys('L', 'L')
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 checktime
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 call assert_match('W11:', v:warningmsg)
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 call assert_equal(2, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 call assert_equal('reload this', getline(1))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 call assert_equal('extra line', getline(2))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 " delete buffer, only shows an error, no prompt
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 silent !rm Xchanged_d
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 checktime
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209 call assert_match('E211:', v:warningmsg)
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 call assert_equal(2, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 call assert_equal('extra line', getline(2))
16754
8b92f3fea477 patch 8.1.1379: filechanged test hangs
Bram Moolenaar <Bram@vim.org>
parents: 16358
diff changeset
212 let v:warningmsg = 'empty'
15615
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213
16754
8b92f3fea477 patch 8.1.1379: filechanged test hangs
Bram Moolenaar <Bram@vim.org>
parents: 16358
diff changeset
214 " change buffer, recreate the file and reload
15615
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215 call setline(1, 'buffer is changed')
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216 silent !echo 'new line' >Xchanged_d
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 call feedkeys('L', 'L')
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 checktime
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 call assert_match('W12:', v:warningmsg)
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220 call assert_equal(1, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 call assert_equal('new line', getline(1))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223 " Only mode changed, reload
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224 silent !chmod +x Xchanged_d
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
225 call feedkeys('L', 'L')
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
226 checktime
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 call assert_match('W16:', v:warningmsg)
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 call assert_equal(1, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 call assert_equal('new line', getline(1))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231 " Only time changed, no prompt
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 sleep 2
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233 silent !touch Xchanged_d
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234 let v:warningmsg = ''
19289
2f0f308c069c patch 8.2.0203: :helptags and some other functionality not tested
Bram Moolenaar <Bram@vim.org>
parents: 17657
diff changeset
235 checktime Xchanged_d
15615
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 call assert_equal('', v:warningmsg)
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 call assert_equal(1, line('$'))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 call assert_equal('new line', getline(1))
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239
20861
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
240 " File created after starting to edit it
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
241 call delete('Xchanged_d')
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
242 new Xchanged_d
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
243 call writefile(['one'], 'Xchanged_d')
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
244 call feedkeys('L', 'L')
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
245 checktime Xchanged_d
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
246 call assert_equal(['one'], getline(1, '$'))
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
247 close!
1725bb56178a patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents: 19407
diff changeset
248
15615
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 bwipe!
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 call delete('Xchanged_d')
536fca2cee19 patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 endfunc
19407
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
252
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
253 " Test for editing a new buffer from a FileChangedShell autocmd
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
254 func Test_FileChangedShell_newbuf()
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
255 call writefile(['one', 'two'], 'Xfile')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
256 new Xfile
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
257 augroup testnewbuf
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
258 autocmd FileChangedShell * enew
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
259 augroup END
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
260 call writefile(['red'], 'Xfile')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
261 call assert_fails('checktime', 'E811:')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
262 au! testnewbuf
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
263 call delete('Xfile')
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
264 endfunc
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
265
2f4be7ca1b1b patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents: 19289
diff changeset
266 " vim: shiftwidth=2 sts=2 expandtab