To: vim_dev@googlegroups.com Subject: Patch 8.2.3181 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3181 Problem: Vim9: builtin function test fails without channel feature. Solution: Add feature checks. (Dominique Pellé, closes #8586) Make feature checks more consistent. Files: src/testdir/test_vim9_builtin.vim *** ../vim-8.2.3180/src/testdir/test_vim9_builtin.vim 2021-07-17 19:11:03.580709066 +0200 --- src/testdir/test_vim9_builtin.vim 2021-07-18 21:40:27.773143406 +0200 *************** *** 398,406 **** enddef def Test_ch_getjob() ! CheckDefAndScriptFailure2(['ch_getjob(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument:') ! CheckDefAndScriptFailure2(['ch_getjob({"a": 10})'], 'E1013: Argument 1: type mismatch, expected channel but got dict', 'E731: Using a Dictionary as a String') ! assert_equal(0, ch_getjob(test_null_channel())) enddef def Test_ch_info() --- 398,410 ---- enddef def Test_ch_getjob() ! if !has('channel') ! CheckFeature channel ! else ! CheckDefAndScriptFailure2(['ch_getjob(1)'], 'E1013: Argument 1: type mismatch, expected channel but got number', 'E475: Invalid argument:') ! CheckDefAndScriptFailure2(['ch_getjob({"a": 10})'], 'E1013: Argument 1: type mismatch, expected channel but got dict', 'E731: Using a Dictionary as a String') ! assert_equal(0, ch_getjob(test_null_channel())) ! endif enddef def Test_ch_info() *************** *** 1425,1441 **** enddef def Test_job_getchannel() ! CheckDefAndScriptFailure2(['job_getchannel("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E475: Invalid argument') ! assert_fails('job_getchannel(test_null_job())', 'E916: not a valid job') enddef def Test_job_info() ! CheckDefAndScriptFailure2(['job_info("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E475: Invalid argument') ! assert_fails('job_info(test_null_job())', 'E916: not a valid job') enddef def Test_job_info_return_type() ! if has('job') job_start(&shell) var jobs = job_info() assert_equal('list', typename(jobs)) --- 1429,1455 ---- enddef def Test_job_getchannel() ! if !has('job') ! CheckFeature job ! else ! CheckDefAndScriptFailure2(['job_getchannel("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E475: Invalid argument') ! assert_fails('job_getchannel(test_null_job())', 'E916: not a valid job') ! endif enddef def Test_job_info() ! if !has('job') ! CheckFeature job ! else ! CheckDefAndScriptFailure2(['job_info("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E475: Invalid argument') ! assert_fails('job_info(test_null_job())', 'E916: not a valid job') ! endif enddef def Test_job_info_return_type() ! if !has('job') ! CheckFeature job ! else job_start(&shell) var jobs = job_info() assert_equal('list', typename(jobs)) *************** *** 1445,1452 **** enddef def Test_job_status() ! CheckDefAndScriptFailure2(['job_status("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E475: Invalid argument') ! assert_equal('fail', job_status(test_null_job())) enddef def Test_js_decode() --- 1459,1470 ---- enddef def Test_job_status() ! if !has('job') ! CheckFeature job ! else ! CheckDefAndScriptFailure2(['job_status("a")'], 'E1013: Argument 1: type mismatch, expected job but got string', 'E475: Invalid argument') ! assert_equal('fail', job_status(test_null_job())) ! endif enddef def Test_js_decode() *************** *** 1877,1883 **** enddef def Test_prompt_getprompt() ! if has('channel') CheckDefFailure(['prompt_getprompt([])'], 'E1013: Argument 1: type mismatch, expected string but got list') assert_equal('', prompt_getprompt('NonExistingBuf')) endif --- 1895,1903 ---- enddef def Test_prompt_getprompt() ! if !has('channel') ! CheckFeature channel ! else CheckDefFailure(['prompt_getprompt([])'], 'E1013: Argument 1: type mismatch, expected string but got list') assert_equal('', prompt_getprompt('NonExistingBuf')) endif *************** *** 2439,2445 **** def Test_spellsuggest() if !has('spell') ! MissingFeature 'spell' else spellsuggest('marrch', 1, true)->assert_equal(['March']) endif --- 2459,2465 ---- def Test_spellsuggest() if !has('spell') ! CheckFeature spell else spellsuggest('marrch', 1, true)->assert_equal(['March']) endif *************** *** 2496,2502 **** def Run_str2float() if !has('float') ! MissingFeature 'float' endif str2float("1.00")->assert_equal(1.00) str2float("2e-2")->assert_equal(0.02) --- 2516,2522 ---- def Run_str2float() if !has('float') ! CheckFeature float endif str2float("1.00")->assert_equal(1.00) str2float("2e-2")->assert_equal(0.02) *************** *** 2721,2727 **** def Test_term_gettty() if !has('terminal') ! MissingFeature 'terminal' else var buf = Run_shell_in_terminal({}) term_gettty(buf, true)->assert_notequal('') --- 2741,2747 ---- def Test_term_gettty() if !has('terminal') ! CheckFeature terminal else var buf = Run_shell_in_terminal({}) term_gettty(buf, true)->assert_notequal('') *************** *** 2754,2760 **** enddef def Test_term_start() if !has('terminal') ! MissingFeature 'terminal' else botright new var winnr = winnr() --- 2774,2780 ---- enddef def Test_term_start() if !has('terminal') ! CheckFeature terminal else botright new var winnr = winnr() *** ../vim-8.2.3180/src/version.c 2021-07-18 21:24:46.866637807 +0200 --- src/version.c 2021-07-18 21:41:54.809007818 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3181, /**/ -- hundred-and-one symptoms of being an internet addict: 176. You lie, even to user-friends, about how long you were online yesterday. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///