1
0
forked from aniani/vim

patch 8.2.2944: Vim9: no error when using job or channel as a string

Problem:    Vim9: no error when using job or channel as a string.
Solution:   Be more strict about conversion to string. (closes #8312)
This commit is contained in:
Bram Moolenaar
2021-06-05 20:51:38 +02:00
parent c6d71532dd
commit 1328bde9d4
9 changed files with 76 additions and 34 deletions

View File

@@ -1104,7 +1104,7 @@ def Test_set_get_bufline()
assert_equal([], getbufline(b, 2, 1))
if has('job')
setbufline(b, 2, [function('eval'), {key: 123}, test_null_job()])
setbufline(b, 2, [function('eval'), {key: 123}, string(test_null_job())])
assert_equal(["function('eval')",
"{'key': 123}",
"no process"],
@@ -1250,6 +1250,16 @@ def Test_submatch()
actual->assert_equal(expected)
enddef
def Test_substitute()
var res = substitute('A1234', '\d', 'X', '')
assert_equal('AX234', res)
if has('job')
assert_fails('"text"->substitute(".*", () => job_start(":"), "")', 'E908: using an invalid value as a String: job')
assert_fails('"text"->substitute(".*", () => job_start(":")->job_getchannel(), "")', 'E908: using an invalid value as a String: channel')
endif
enddef
def Test_synID()
new
setline(1, "text")