Mercurial > vim
comparison src/testdir/test_fold.vim @ 30552:a7a9e8b9af89 v9.0.0611
patch 9.0.0611: tests delete files with a separate delete() call
Commit: https://github.com/vim/vim/commit/70e672580b39eb79607c304803efb954cc11f4e6
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Sep 27 19:34:35 2022 +0100
patch 9.0.0611: tests delete files with a separate delete() call
Problem: Tests delete files with a separate delete() call.
Solution: Use deferred delete.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 27 Sep 2022 20:45:03 +0200 |
parents | 13b02c1ea0f7 |
children | 586b5b3aacf9 |
comparison
equal
deleted
inserted
replaced
30551:b2b10228a466 | 30552:a7a9e8b9af89 |
---|---|
135 call setline(1, repeat(["\<Tab>a"], 4)) | 135 call setline(1, repeat(["\<Tab>a"], 4)) |
136 for n in range(1, 4) | 136 for n in range(1, 4) |
137 call assert_equal(1, foldlevel(n)) | 137 call assert_equal(1, foldlevel(n)) |
138 endfor | 138 endfor |
139 | 139 |
140 call writefile(["a", "", "\<Tab>a"], 'Xinfofile') | 140 call writefile(["a", "", "\<Tab>a"], 'Xinfofile', 'D') |
141 foldopen | 141 foldopen |
142 2read Xinfofile | 142 2read Xinfofile |
143 %foldclose | 143 %foldclose |
144 call assert_equal(1, foldlevel(1)) | 144 call assert_equal(1, foldlevel(1)) |
145 call assert_equal(2, foldclosedend(1)) | 145 call assert_equal(2, foldclosedend(1)) |
148 call assert_equal(1, foldlevel(5)) | 148 call assert_equal(1, foldlevel(5)) |
149 call assert_equal(7, 5->foldclosedend()) | 149 call assert_equal(7, 5->foldclosedend()) |
150 | 150 |
151 bwipe! | 151 bwipe! |
152 set foldmethod& | 152 set foldmethod& |
153 call delete('Xinfofile') | |
154 endfunc | 153 endfunc |
155 | 154 |
156 func Test_combining_folds_indent() | 155 func Test_combining_folds_indent() |
157 new | 156 new |
158 let one = "\<Tab>a" | 157 let one = "\<Tab>a" |
214 call setline(1, ['a', 'a', 'a', 'a', 'a', 'a']) | 213 call setline(1, ['a', 'a', 'a', 'a', 'a', 'a']) |
215 set foldmethod=expr | 214 set foldmethod=expr |
216 set foldexpr=s:TestFoldExpr(v:lnum) | 215 set foldexpr=s:TestFoldExpr(v:lnum) |
217 2 | 216 2 |
218 foldopen | 217 foldopen |
219 call writefile(['b', 'b', 'a', 'a', 'd', 'a', 'a', 'c'], 'Xupfofile') | 218 call writefile(['b', 'b', 'a', 'a', 'd', 'a', 'a', 'c'], 'Xupfofile', 'D') |
220 read Xupfofile | 219 read Xupfofile |
221 %foldclose | 220 %foldclose |
222 call assert_equal(2, foldclosedend(1)) | 221 call assert_equal(2, foldclosedend(1)) |
223 call assert_equal(0, foldlevel(3)) | 222 call assert_equal(0, foldlevel(3)) |
224 call assert_equal(0, 4->foldlevel()) | 223 call assert_equal(0, 4->foldlevel()) |
225 call assert_equal(6, foldclosedend(5)) | 224 call assert_equal(6, foldclosedend(5)) |
226 call assert_equal(10, foldclosedend(7)) | 225 call assert_equal(10, foldclosedend(7)) |
227 call assert_equal(14, foldclosedend(11)) | 226 call assert_equal(14, foldclosedend(11)) |
228 | 227 |
229 call delete('Xupfofile') | |
230 bwipe! | 228 bwipe! |
231 set foldmethod& foldexpr& | 229 set foldmethod& foldexpr& |
232 endfunc | 230 endfunc |
233 | 231 |
234 " Test for what patch 8.1.0535 fixes. | 232 " Test for what patch 8.1.0535 fixes. |
806 CheckScreendump | 804 CheckScreendump |
807 | 805 |
808 call writefile([ | 806 call writefile([ |
809 \ 'set fdm=marker rnu foldcolumn=2', | 807 \ 'set fdm=marker rnu foldcolumn=2', |
810 \ 'call setline(1, ["{{{1", "nline 1", "{{{1", "line 2"])', | 808 \ 'call setline(1, ["{{{1", "nline 1", "{{{1", "line 2"])', |
811 \ ], 'Xtest_folds_with_rnu') | 809 \ ], 'Xtest_folds_with_rnu', 'D') |
812 let buf = RunVimInTerminal('-S Xtest_folds_with_rnu', {}) | 810 let buf = RunVimInTerminal('-S Xtest_folds_with_rnu', {}) |
813 | 811 |
814 call VerifyScreenDump(buf, 'Test_folds_with_rnu_01', {}) | 812 call VerifyScreenDump(buf, 'Test_folds_with_rnu_01', {}) |
815 call term_sendkeys(buf, "j") | 813 call term_sendkeys(buf, "j") |
816 call VerifyScreenDump(buf, 'Test_folds_with_rnu_02', {}) | 814 call VerifyScreenDump(buf, 'Test_folds_with_rnu_02', {}) |
817 | 815 |
818 " clean up | 816 " clean up |
819 call StopVimInTerminal(buf) | 817 call StopVimInTerminal(buf) |
820 call delete('Xtest_folds_with_rnu') | |
821 endfunc | 818 endfunc |
822 | 819 |
823 func Test_folds_marker_in_comment2() | 820 func Test_folds_marker_in_comment2() |
824 new | 821 new |
825 call setline(1, ['Lorem ipsum dolor sit', 'Lorem ipsum dolor sit', 'Lorem ipsum dolor sit']) | 822 call setline(1, ['Lorem ipsum dolor sit', 'Lorem ipsum dolor sit', 'Lorem ipsum dolor sit']) |
1261 redraw! | 1258 redraw! |
1262 call writefile([json_encode([foldclosed(1), foldclosed(2), foldclosed(3), | 1259 call writefile([json_encode([foldclosed(1), foldclosed(2), foldclosed(3), |
1263 \ foldclosed(4)])], 'Xoutput', 'a') | 1260 \ foldclosed(4)])], 'Xoutput', 'a') |
1264 endfunc | 1261 endfunc |
1265 END | 1262 END |
1266 call writefile(lines, 'Xscript') | 1263 call writefile(lines, 'Xscript', 'D') |
1267 let rows = 10 | 1264 let rows = 10 |
1268 let buf = RunVimInTerminal('-S Xscript', {'rows': rows}) | 1265 let buf = RunVimInTerminal('-S Xscript', {'rows': rows}) |
1269 call term_wait(buf) | 1266 call term_wait(buf) |
1270 call term_sendkeys(buf, ":set noruler\n") | 1267 call term_sendkeys(buf, ":set noruler\n") |
1271 call term_wait(buf) | 1268 call term_wait(buf) |
1290 " clean up | 1287 " clean up |
1291 call StopVimInTerminal(buf) | 1288 call StopVimInTerminal(buf) |
1292 | 1289 |
1293 call assert_equal(['[-1,2,2,-1]', '[-1,-1,-1,-1]', '[-1,2,2,-1]', | 1290 call assert_equal(['[-1,2,2,-1]', '[-1,-1,-1,-1]', '[-1,2,2,-1]', |
1294 \ '[-1,-1,-1,-1]', '[-1,2,2,-1]'], readfile('Xoutput')) | 1291 \ '[-1,-1,-1,-1]', '[-1,2,2,-1]'], readfile('Xoutput')) |
1295 call delete('Xscript') | |
1296 call delete('Xoutput') | 1292 call delete('Xoutput') |
1297 endfunc | 1293 endfunc |
1298 | 1294 |
1299 " Test for foldtextresult() | 1295 " Test for foldtextresult() |
1300 func Test_foldtextresult() | 1296 func Test_foldtextresult() |