Mercurial > vim
annotate src/testdir/test_filechanged.vim @ 36550:585c95e95ea3 draft default tip
runtime(doc): update how to report issues for mac Vim
Commit: https://github.com/vim/vim/commit/8b97ca66cf7e3e780a56fe5b07c491dd6833ea3c
Author: Christian Brabandt <cb@256bit.org>
Date: Thu Nov 14 21:12:38 2024 +0100
runtime(doc): update how to report issues for mac Vim
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 14 Nov 2024 21:15:09 +0100 |
parents | 49637bd5c863 |
children |
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 |
34788
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
14 " Need to wait until the timestamp would change. |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
15 if has('nanotime') |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
16 sleep 10m |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
17 else |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
18 sleep 2 |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
19 endif |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
20 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
|
21 checktime |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
22 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
|
23 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
|
24 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
|
25 |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
26 " 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
|
27 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
|
28 checktime |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
29 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
|
30 |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
31 " 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
|
32 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
|
33 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
|
34 checktime |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
35 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
|
36 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
|
37 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
|
38 |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
39 " 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
|
40 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
|
41 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
|
42 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
|
43 checktime |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
44 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
|
45 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
|
46 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
|
47 |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
48 " 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
|
49 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
|
50 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
|
51 checktime |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
52 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
|
53 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
|
54 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
|
55 |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
56 " Only time changed |
34788
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
57 if has('nanotime') |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
58 sleep 10m |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
59 else |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
60 sleep 2 |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
61 endif |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
62 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
|
63 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
|
64 checktime |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
65 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
|
66 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
|
67 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
|
68 |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
69 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
|
70 " 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
|
71 " reload. |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
72 set undofile |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
73 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
|
74 write |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
75 call setline(2, 'after write') |
34788
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
76 if has('nanotime') |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
77 sleep 10m |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
78 else |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
79 sleep 2 |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
80 endif |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
81 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
|
82 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
|
83 checktime |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
84 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
|
85 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
|
86 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
|
87 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
|
88 " 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
|
89 undo |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
90 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
|
91 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
|
92 " 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
|
93 undo |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
94 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
|
95 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
|
96 |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
97 set noundofile |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
98 endif |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
99 |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
100 au! testreload |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
101 bwipe! |
16358
1a441c73adbc
patch 8.1.1184: undo file left behind after running test
Bram Moolenaar <Bram@vim.org>
parents:
15625
diff
changeset
|
102 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
|
103 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
|
104 endfunc |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
105 |
27635
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
106 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
|
107 CheckUnix |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
108 |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
109 new Xchanged_r |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
110 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
|
111 set fileformat=unix |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
112 write |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
113 |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
114 " 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
|
115 augroup testreload |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
116 au! |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
117 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
|
118 augroup END |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
119 call assert_equal(&fileformat, 'unix') |
30552
a7a9e8b9af89
patch 9.0.0611: tests delete files with a separate delete() call
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
120 call writefile(["line1\r", "line2\r"], 'Xchanged_r', 'D') |
27635
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
121 let g:reason = '' |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
122 checktime |
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('changed', g:reason) |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
124 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
|
125 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
|
126 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
|
127 %s/\r |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
128 write |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
129 |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
130 " 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
|
131 augroup testreload |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
132 au! |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
133 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
|
134 augroup END |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
135 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
|
136 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
|
137 let g:reason = '' |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
138 checktime |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
139 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
|
140 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
|
141 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
|
142 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
|
143 set fileformat=unix |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
144 write |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
145 |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
146 au! testreload |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
147 bwipe! |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
148 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
|
149 endfunc |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
150 |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
151 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
|
152 CheckNotGui |
28247
f70015784777
patch 8.2.4649: various formatting problems
Bram Moolenaar <Bram@vim.org>
parents:
27647
diff
changeset
|
153 CheckUnix " Using low level feedkeys() does not work on MS-Windows. |
27635
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
154 |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
155 new Xchanged_r |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
156 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
|
157 set fileformat=unix |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
158 write |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
159 |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
160 " 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
|
161 augroup testreload |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
162 au! |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
163 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
|
164 augroup END |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
165 call assert_equal(&fileformat, 'unix') |
30552
a7a9e8b9af89
patch 9.0.0611: tests delete files with a separate delete() call
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
166 call writefile(["line1\r", "line2\r"], 'Xchanged_r', 'D') |
27635
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
167 let g:reason = '' |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
168 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
|
169 checktime |
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('changed', g:reason) |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
171 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
|
172 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
|
173 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
|
174 %s/\r |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
175 write |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
176 |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
177 " 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
|
178 augroup testreload |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
179 au! |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
180 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
|
181 augroup END |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
182 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
|
183 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
|
184 let g:reason = '' |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
185 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
|
186 checktime |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
187 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
|
188 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
|
189 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
|
190 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
|
191 set fileformat=unix |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
192 write |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
193 |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
194 au! testreload |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
195 bwipe! |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
196 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
|
197 endfunc |
6ca2d8f4cd32
patch 8.2.4343: when reloading not all properties are detected
Bram Moolenaar <Bram@vim.org>
parents:
20861
diff
changeset
|
198 |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
199 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
|
200 CheckUnix |
0da9bc55c31a
patch 8.1.1826: tests use hand coded feature and option checks
Bram Moolenaar <Bram@vim.org>
parents:
16754
diff
changeset
|
201 CheckNotGui |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
202 au! FileChangedShell |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
203 |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
204 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
|
205 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
|
206 write |
34788
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
207 " Need to wait until the timestamp would change. |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
208 if has('nanotime') |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
209 sleep 10m |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
210 else |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
211 sleep 2 |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
212 endif |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
213 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
|
214 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
|
215 checktime |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
216 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
|
217 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
|
218 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
|
219 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
|
220 |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
221 " 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
|
222 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
|
223 checktime |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
224 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
|
225 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
|
226 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
|
227 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
|
228 |
16754
8b92f3fea477
patch 8.1.1379: filechanged test hangs
Bram Moolenaar <Bram@vim.org>
parents:
16358
diff
changeset
|
229 " 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
|
230 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
|
231 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
|
232 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
|
233 checktime |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
234 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
|
235 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
|
236 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
|
237 |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
238 " 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
|
239 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
|
240 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
|
241 checktime |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
242 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
|
243 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
|
244 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
|
245 |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
246 " Only time changed, no prompt |
34788
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
247 if has('nanotime') |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
248 sleep 10m |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
249 else |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
250 sleep 2 |
49637bd5c863
patch 9.1.0268: Two tests in test_filechanged.vim are slow
Christian Brabandt <cb@256bit.org>
parents:
30552
diff
changeset
|
251 endif |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
252 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
|
253 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
|
254 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
|
255 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
|
256 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
|
257 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
|
258 |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
19407
diff
changeset
|
259 " 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
|
260 call delete('Xchanged_d') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
19407
diff
changeset
|
261 new Xchanged_d |
30552
a7a9e8b9af89
patch 9.0.0611: tests delete files with a separate delete() call
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
262 call writefile(['one'], 'Xchanged_d', 'D') |
20861
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
19407
diff
changeset
|
263 call feedkeys('L', 'L') |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
19407
diff
changeset
|
264 checktime Xchanged_d |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
19407
diff
changeset
|
265 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
|
266 close! |
1725bb56178a
patch 8.2.0982: insufficient testing for reading/writing files
Bram Moolenaar <Bram@vim.org>
parents:
19407
diff
changeset
|
267 |
15615
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
268 bwipe! |
536fca2cee19
patch 8.1.0815: dialog for file changed outside of Vim not tested
Bram Moolenaar <Bram@vim.org>
parents:
diff
changeset
|
269 endfunc |
19407
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
270 |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
271 " 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
|
272 func Test_FileChangedShell_newbuf() |
30552
a7a9e8b9af89
patch 9.0.0611: tests delete files with a separate delete() call
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
273 call writefile(['one', 'two'], 'Xchfile', 'D') |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
28247
diff
changeset
|
274 new Xchfile |
19407
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
275 augroup testnewbuf |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
276 autocmd FileChangedShell * enew |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
277 augroup END |
30051
13b02c1ea0f7
patch 9.0.0363: common names in test files causes tests to be flaky
Bram Moolenaar <Bram@vim.org>
parents:
28247
diff
changeset
|
278 call writefile(['red'], 'Xchfile') |
19407
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
279 call assert_fails('checktime', 'E811:') |
30552
a7a9e8b9af89
patch 9.0.0611: tests delete files with a separate delete() call
Bram Moolenaar <Bram@vim.org>
parents:
30051
diff
changeset
|
280 |
19407
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
281 au! testnewbuf |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
282 endfunc |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
283 |
2f4be7ca1b1b
patch 8.2.0261: some code not covered by tests
Bram Moolenaar <Bram@vim.org>
parents:
19289
diff
changeset
|
284 " vim: shiftwidth=2 sts=2 expandtab |