summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominique Pelle <dominique.pelle@gmail.com>2021-07-18 21:44:37 +0200
committerBram Moolenaar <Bram@vim.org>2021-07-18 21:44:37 +0200
commit9ff9c7b9741b216d3dc75603e50654088dc5f55b (patch)
tree09a39696f0e161853436fab0bff3e2adbe48087b
parentf6488547e3c7e41ff2c12dd0b93c9ef04e4c8c6f (diff)
patch 8.2.3181: Vim9: builtin function test fails without channel featurev8.2.3181
Problem: Vim9: builtin function test fails without channel feature. Solution: Add feature checks. (Dominique Pellé, closes #8586) Make feature checks more consistent.
-rw-r--r--src/testdir/test_vim9_builtin.vim50
-rw-r--r--src/version.c2
2 files changed, 37 insertions, 15 deletions
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index 0668797386..638d7daa13 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -398,9 +398,13 @@ def Test_ch_close_in()
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<number>', 'E731: Using a Dictionary as a String')
- assert_equal(0, ch_getjob(test_null_channel()))
+ 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<number>', 'E731: Using a Dictionary as a String')
+ assert_equal(0, ch_getjob(test_null_channel()))
+ endif
enddef
def Test_ch_info()
@@ -1425,17 +1429,27 @@ def Test_items()
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')
+ 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()
- 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')
+ 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')
+ if !has('job')
+ CheckFeature job
+ else
job_start(&shell)
var jobs = job_info()
assert_equal('list<job>', typename(jobs))
@@ -1445,8 +1459,12 @@ def Test_job_info_return_type()
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()))
+ 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,7 +1895,9 @@ def Test_prevnonblank()
enddef
def Test_prompt_getprompt()
- if has('channel')
+ if !has('channel')
+ CheckFeature channel
+ else
CheckDefFailure(['prompt_getprompt([])'], 'E1013: Argument 1: type mismatch, expected string but got list<unknown>')
assert_equal('', prompt_getprompt('NonExistingBuf'))
endif
@@ -2439,7 +2459,7 @@ enddef
def Test_spellsuggest()
if !has('spell')
- MissingFeature 'spell'
+ CheckFeature spell
else
spellsuggest('marrch', 1, true)->assert_equal(['March'])
endif
@@ -2496,7 +2516,7 @@ enddef
def Run_str2float()
if !has('float')
- MissingFeature 'float'
+ CheckFeature float
endif
str2float("1.00")->assert_equal(1.00)
str2float("2e-2")->assert_equal(0.02)
@@ -2721,7 +2741,7 @@ enddef
def Test_term_gettty()
if !has('terminal')
- MissingFeature 'terminal'
+ CheckFeature terminal
else
var buf = Run_shell_in_terminal({})
term_gettty(buf, true)->assert_notequal('')
@@ -2754,7 +2774,7 @@ def Test_term_setrestore()
enddef
def Test_term_start()
if !has('terminal')
- MissingFeature 'terminal'
+ CheckFeature terminal
else
botright new
var winnr = winnr()
diff --git a/src/version.c b/src/version.c
index b59eca27a6..371fdcd881 100644
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 3181,
+/**/
3180,
/**/
3179,