comparison src/testdir/test_vim9_script.vim @ 23656:c6f7df86cd9d v8.2.2370

patch 8.2.2370: Vim9: command fails in catch block Commit: https://github.com/vim/vim/commit/1430ceeb2d4185a8d60fa81007fbc8b74fd68c46 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 17 19:20:32 2021 +0100 patch 8.2.2370: Vim9: command fails in catch block Problem: Vim9: command fails in catch block. Solution: Reset force_abort and need_rethrow. (closes https://github.com/vim/vim/issues/7692)
author Bram Moolenaar <Bram@vim.org>
date Sun, 17 Jan 2021 19:30:04 +0100
parents d228ca435f3a
children c8f26523d7d7
comparison
equal deleted inserted replaced
23655:1c9c8221f546 23656:c6f7df86cd9d
554 echo d.member 554 echo d.member
555 catch /E716:/ 555 catch /E716:/
556 n = 411 556 n = 411
557 endtry 557 endtry
558 assert_equal(411, n) 558 assert_equal(411, n)
559 enddef
560
561 def Test_cnext_works_in_catch()
562 var lines =<< trim END
563 vim9script
564 au BufEnter * eval 0
565 writefile(['text'], 'Xfile1')
566 writefile(['text'], 'Xfile2')
567 var items = [
568 {lnum: 1, filename: 'Xfile1', valid: true},
569 {lnum: 1, filename: 'Xfile2', valid: true}
570 ]
571 setqflist([], ' ', {items: items})
572 cwindow
573
574 def CnextOrCfirst()
575 # if cnext fails, cfirst is used
576 try
577 cnext
578 catch
579 cfirst
580 endtry
581 enddef
582
583 CnextOrCfirst()
584 CnextOrCfirst()
585 writefile([getqflist({idx: 0}).idx], 'Xresult')
586 qall
587 END
588 writefile(lines, 'XCatchCnext')
589 RunVim([], [], '--clean -S XCatchCnext')
590 assert_equal(['1'], readfile('Xresult'))
591
592 delete('Xfile1')
593 delete('Xfile2')
594 delete('XCatchCnext')
595 delete('Xresult')
559 enddef 596 enddef
560 597
561 def Test_throw_skipped() 598 def Test_throw_skipped()
562 if 0 599 if 0
563 throw dontgethere 600 throw dontgethere