aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testing.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-11-05 12:28:19 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-11-05 12:31:31 +0800
commitb33de61cc3e14cc6160a972205f6543e82b843aa (patch)
tree0328a930a9b4b23a0f9fc579ce9fb1a122c27cb8 /src/nvim/testing.c
parent159d52b433055e957fec6dee5da20f23fabf10d4 (diff)
downloadrneovim-b33de61cc3e14cc6160a972205f6543e82b843aa.tar.gz
rneovim-b33de61cc3e14cc6160a972205f6543e82b843aa.tar.bz2
rneovim-b33de61cc3e14cc6160a972205f6543e82b843aa.zip
vim-patch:8.2.1199: not all assert functions are fully tested
Problem: Not all assert functions are fully tested. Solution: Test more assert functions. https://github.com/vim/vim/commit/7177da9dd4d9a521c6141c6fbf7e9a4d6296ab05 Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/testing.c')
-rw-r--r--src/nvim/testing.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/nvim/testing.c b/src/nvim/testing.c
index 5c0e757ccf..e1a28fbde3 100644
--- a/src/nvim/testing.c
+++ b/src/nvim/testing.c
@@ -68,7 +68,7 @@ static void ga_concat_esc(garray_T *gap, const char_u *p, int clen)
case '\\':
ga_concat(gap, "\\\\"); break;
default:
- if (*p < ' ') {
+ if (*p < ' ' || *p == 0x7f) {
vim_snprintf((char *)buf, NUMBUFLEN, "\\x%02x", *p);
ga_concat(gap, (char *)buf);
} else {
@@ -244,12 +244,12 @@ static int assert_match_common(typval_T *argvars, assert_type_T atype)
{
char buf1[NUMBUFLEN];
char buf2[NUMBUFLEN];
+ const int called_emsg_before = called_emsg;
const char *const pat = tv_get_string_buf_chk(&argvars[0], buf1);
const char *const text = tv_get_string_buf_chk(&argvars[1], buf2);
- if (pat == NULL || text == NULL) {
- emsg(_(e_invarg));
- } else if (pattern_match(pat, text, false) != (atype == ASSERT_MATCH)) {
+ if (called_emsg == called_emsg_before
+ && pattern_match(pat, text, false) != (atype == ASSERT_MATCH)) {
garray_T ga;
prepare_assert_error(&ga);
fill_assert_error(&ga, &argvars[2], NULL, &argvars[0], &argvars[1], atype);
@@ -350,11 +350,12 @@ static int assert_equalfile(typval_T *argvars)
{
char buf1[NUMBUFLEN];
char buf2[NUMBUFLEN];
+ const int called_emsg_before = called_emsg;
const char *const fname1 = tv_get_string_buf_chk(&argvars[0], buf1);
const char *const fname2 = tv_get_string_buf_chk(&argvars[1], buf2);
garray_T ga;
- if (fname1 == NULL || fname2 == NULL) {
+ if (called_emsg > called_emsg_before) {
return 0;
}