1
0
forked from aniani/vim

patch 8.2.1569: Vim9: fixes not tested; failure in getchangelist()

Problem:    Vim9: fixes for functions not tested; failure in getchangelist().
Solution:   Add tests. (closes #6813, closes #6815, closes #6817)
This commit is contained in:
Bram Moolenaar
2020-09-02 21:02:35 +02:00
parent 4da7a259f6
commit a5d3841177
3 changed files with 36 additions and 6 deletions

View File

@@ -3081,12 +3081,7 @@ f_getchangelist(typval_T *argvars, typval_T *rettv)
if (argvars[0].v_type == VAR_UNKNOWN) if (argvars[0].v_type == VAR_UNKNOWN)
buf = curbuf; buf = curbuf;
else else
{ buf = tv_get_buf_from_arg(&argvars[0]);
(void)tv_get_number(&argvars[0]); // issue errmsg if type error
++emsg_off;
buf = tv_get_buf(&argvars[0], FALSE);
--emsg_off;
}
if (buf == NULL) if (buf == NULL)
return; return;

View File

@@ -1431,6 +1431,39 @@ def Test_setbufvar()
assert_equal(123, getbufvar('%', 'myvar')) assert_equal(123, getbufvar('%', 'myvar'))
enddef enddef
def Test_bufwinid()
let origwin = win_getid()
below split SomeFile
let SomeFileID = win_getid()
below split OtherFile
below split SomeFile
assert_equal(SomeFileID, bufwinid('SomeFile'))
win_gotoid(origwin)
only
bwipe SomeFile
bwipe OtherFile
enddef
def Test_getbufline()
e SomeFile
let buf = bufnr()
e #
let lines = ['aaa', 'bbb', 'ccc']
setbufline(buf, 1, lines)
assert_equal(lines, getbufline('#', 1, '$'))
bwipe!
enddef
def Test_getchangelist()
new
setline(1, 'some text')
let changelist = bufnr()->getchangelist()
assert_equal(changelist, getchangelist('%'))
bwipe!
enddef
def Test_setreg() def Test_setreg()
setreg('a', ['aaa', 'bbb', 'ccc']) setreg('a', ['aaa', 'bbb', 'ccc'])
let reginfo = getreginfo('a') let reginfo = getreginfo('a')

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1569,
/**/ /**/
1568, 1568,
/**/ /**/