mirror of
https://github.com/neovim/neovim.git
synced 2026-03-31 04:42:03 +00:00
vim-patch:9.1.1987: assert_equal() prepends unnecessary ':' when typed
Problem: assert_equal() prepends unnecessary ':' when typed
(after 9.0.1758).
Solution: Don't change a NULL stacktrace to an empty string (zeertzjq).
closes: vim/vim#18936
c4b3aefd0d
This commit is contained in:
@@ -229,7 +229,10 @@ char *estack_sfile(estack_arg_T which)
|
||||
}
|
||||
}
|
||||
|
||||
ga_append(&ga, NUL);
|
||||
// Only NUL-terminate when not returning NULL.
|
||||
if (ga.ga_data != NULL) {
|
||||
ga_append(&ga, NUL);
|
||||
}
|
||||
return (char *)ga.ga_data;
|
||||
}
|
||||
|
||||
|
||||
@@ -386,6 +386,19 @@ func Test_assert_fails_in_timer()
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
" Check that a typed assert_equal() doesn't prepend an unnecessary ':'.
|
||||
func Test_assert_equal_typed()
|
||||
let after =<< trim END
|
||||
call feedkeys(":call assert_equal(0, 1)\<CR>", 't')
|
||||
call feedkeys(":call writefile(v:errors, 'Xerrors')\<CR>", 't')
|
||||
call feedkeys(":qa!\<CR>", 't')
|
||||
END
|
||||
call assert_equal(1, RunVim([], after, ''))
|
||||
call assert_equal(['Expected 0 but got 1'], readfile('Xerrors'))
|
||||
|
||||
call delete('Xerrors')
|
||||
endfunc
|
||||
|
||||
func Test_assert_beeps()
|
||||
new
|
||||
call assert_equal(0, assert_beeps('normal h'))
|
||||
|
||||
Reference in New Issue
Block a user