Mercurial > vim
comparison src/testdir/test_trycatch.vim @ 30865:c8ebe35b2475 v9.0.0767
patch 9.0.0767: too many delete() calls in tests
Commit: https://github.com/vim/vim/commit/c4860bdd2832feb7ab054c6dc14f68abe24c2373
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Oct 15 20:52:26 2022 +0100
patch 9.0.0767: too many delete() calls in tests
Problem: Too many delete() calls in tests.
Solution: Use deferred delete where possible.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 15 Oct 2022 22:00:04 +0200 |
parents | 4bbc920bdef7 |
children | 6f74f567b1e6 |
comparison
equal
deleted
inserted
replaced
30864:51906709cb7a | 30865:c8ebe35b2475 |
---|---|
1973 | 1973 |
1974 call assert_equal('jlmnpqrtueghivyzACD', g:Xpath) | 1974 call assert_equal('jlmnpqrtueghivyzACD', g:Xpath) |
1975 endfunc | 1975 endfunc |
1976 | 1976 |
1977 func Test_reload_in_try_catch() | 1977 func Test_reload_in_try_catch() |
1978 call writefile(['x'], 'Xreload') | 1978 call writefile(['x'], 'Xreload', 'D') |
1979 set autoread | 1979 set autoread |
1980 edit Xreload | 1980 edit Xreload |
1981 tabnew | 1981 tabnew |
1982 call writefile(['xx'], 'Xreload') | 1982 call writefile(['xx'], 'Xreload') |
1983 augroup ReLoad | 1983 augroup ReLoad |
1993 tabclose | 1993 tabclose |
1994 tabclose | 1994 tabclose |
1995 autocmd! ReLoad | 1995 autocmd! ReLoad |
1996 set noautoread | 1996 set noautoread |
1997 bwipe! Xreload | 1997 bwipe! Xreload |
1998 call delete('Xreload') | |
1999 endfunc | 1998 endfunc |
2000 | 1999 |
2001 " Test for errors with :catch, :throw, :finally {{{1 | 2000 " Test for errors with :catch, :throw, :finally {{{1 |
2002 func Test_try_catch_errors() | 2001 func Test_try_catch_errors() |
2003 call assert_fails('throw |', 'E471:') | 2002 call assert_fails('throw |', 'E471:') |
2304 endfunc | 2303 endfunc |
2305 | 2304 |
2306 call s:main() | 2305 call s:main() |
2307 call assert_equal('yes', s:caught) | 2306 call assert_equal('yes', s:caught) |
2308 END | 2307 END |
2309 call writefile(lines, 'XtestThrow') | 2308 call writefile(lines, 'XtestThrow', 'D') |
2310 source XtestThrow | 2309 source XtestThrow |
2311 | |
2312 call delete('XtestThrow') | |
2313 endfunc | 2310 endfunc |
2314 | 2311 |
2315 func ThisWillFail() | 2312 func ThisWillFail() |
2316 | 2313 |
2317 endfunc | 2314 endfunc |
2323 echo x | 2320 echo x |
2324 catch | 2321 catch |
2325 for l in [] | 2322 for l in [] |
2326 finally | 2323 finally |
2327 END | 2324 END |
2328 call writefile(lines, 'XtestCatchAndFinally') | 2325 call writefile(lines, 'XtestCatchAndFinally', 'D') |
2329 try | 2326 try |
2330 source XtestCatchAndFinally | 2327 source XtestCatchAndFinally |
2331 catch /E600:/ | 2328 catch /E600:/ |
2332 endtry | 2329 endtry |
2333 | |
2334 call delete('XtestCatchAndFinally') | |
2335 endfunc | 2330 endfunc |
2336 | 2331 |
2337 " This was causing an illegal memory access | 2332 " This was causing an illegal memory access |
2338 func Test_leave_block_in_endtry_not_called() | 2333 func Test_leave_block_in_endtry_not_called() |
2339 let lines =<< trim END | 2334 let lines =<< trim END |
2343 if | 2338 if |
2344 endwhile | 2339 endwhile |
2345 if | 2340 if |
2346 endtry | 2341 endtry |
2347 END | 2342 END |
2348 call writefile(lines, 'XtestEndtry') | 2343 call writefile(lines, 'XtestEndtry', 'D') |
2349 try | 2344 try |
2350 source XtestEndtry | 2345 source XtestEndtry |
2351 catch /E171:/ | 2346 catch /E171:/ |
2352 endtry | 2347 endtry |
2353 | |
2354 call delete('XtestEndtry') | |
2355 endfunc | 2348 endfunc |
2356 | 2349 |
2357 " Modeline {{{1 | 2350 " Modeline {{{1 |
2358 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | 2351 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |