mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
vim-patch:8.2.0893: assert_equalfile() does not take a third argument
Problem: Assert_equalfile() does not take a third argument.
Solution: Implement the third argument. (Gary Johnson)
fb517bac23
This commit is contained in:
@@ -5739,6 +5739,12 @@ int assert_equalfile(typval_T *argvars)
|
||||
}
|
||||
if (IObuff[0] != NUL) {
|
||||
prepare_assert_error(&ga);
|
||||
if (argvars[2].v_type != VAR_UNKNOWN) {
|
||||
char *const tofree = encode_tv2echo(&argvars[2], NULL);
|
||||
ga_concat(&ga, (char_u *)tofree);
|
||||
xfree(tofree);
|
||||
ga_concat(&ga, (char_u *)": ");
|
||||
}
|
||||
ga_concat(&ga, IObuff);
|
||||
assert_error(&ga);
|
||||
ga_clear(&ga);
|
||||
|
@@ -28,7 +28,7 @@ return {
|
||||
asin={args=1, func="float_op_wrapper", data="&asin"}, -- WJMc
|
||||
assert_beeps={args={1, 2}},
|
||||
assert_equal={args={2, 3}},
|
||||
assert_equalfile={args=2},
|
||||
assert_equalfile={args={2, 3}},
|
||||
assert_exception={args={1, 2}},
|
||||
assert_fails={args={1, 3}},
|
||||
assert_false={args={1, 2}},
|
||||
|
@@ -415,7 +415,7 @@ static void f_assert_equal(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
rettv->vval.v_number = assert_equal_common(argvars, ASSERT_EQUAL);
|
||||
}
|
||||
|
||||
// "assert_equalfile(fname-one, fname-two)" function
|
||||
// "assert_equalfile(fname-one, fname-two[, msg])" function
|
||||
static void f_assert_equalfile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
{
|
||||
rettv->vval.v_number = assert_equalfile(argvars);
|
||||
|
@@ -31,6 +31,10 @@ func Test_assert_equalfile()
|
||||
call assert_match("difference at byte 4", v:errors[0])
|
||||
call remove(v:errors, 0)
|
||||
|
||||
call assert_equal(1, assert_equalfile('Xone', 'Xtwo', 'a message'))
|
||||
call assert_match("a message: difference at byte 4", v:errors[0])
|
||||
call remove(v:errors, 0)
|
||||
|
||||
call delete('Xone')
|
||||
call delete('Xtwo')
|
||||
endfunc
|
||||
|
Reference in New Issue
Block a user