From bb6190bec5f18c1f9e2c1d29ef1f7cf7912ea625 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 1 Jun 2024 08:19:41 -0700 Subject: refactor: move shared messages to errors.h #26214 --- src/nvim/testing.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/testing.c') diff --git a/src/nvim/testing.c b/src/nvim/testing.c index 343568d71e..8041cc2e33 100644 --- a/src/nvim/testing.c +++ b/src/nvim/testing.c @@ -7,6 +7,7 @@ #include #include "nvim/ascii_defs.h" +#include "nvim/errors.h" #include "nvim/eval.h" #include "nvim/eval/encode.h" #include "nvim/eval/typval.h" -- cgit From 2a883d9c597e70d25ffc53373731d05d18a89b91 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 5 Jul 2024 15:20:02 +0800 Subject: vim-patch:9.1.0524: the recursive parameter in the *_equal functions can be removed (#29572) Problem: the recursive parameter in the *_equal functions can be removed Solution: Remove the recursive parameter in dict_equal(), list_equal() object_equal and tv_equal(). Use a comparison of the static var recursive_cnt == 0 to determine whether or not tv_equal() has been called recursively (Yinzuo Jiang). closes: vim/vim#15070 https://github.com/vim/vim/commit/7ccd1a2e858dbb2ac7fb09971dfcbfad62baa677 Co-authored-by: Yinzuo Jiang --- src/nvim/testing.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/nvim/testing.c') diff --git a/src/nvim/testing.c b/src/nvim/testing.c index 8041cc2e33..4dc8984fa9 100644 --- a/src/nvim/testing.c +++ b/src/nvim/testing.c @@ -198,7 +198,7 @@ static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, const char *e if (!HASHITEM_EMPTY(hi)) { dictitem_T *item2 = tv_dict_find(got_d, hi->hi_key, -1); if (item2 == NULL - || !tv_equal(&TV_DICT_HI2DI(hi)->di_tv, &item2->di_tv, false, false)) { + || !tv_equal(&TV_DICT_HI2DI(hi)->di_tv, &item2->di_tv, false)) { // item of exp_d not present in got_d or values differ. const size_t key_len = strlen(hi->hi_key); tv_dict_add_tv(exp_tv->vval.v_dict, hi->hi_key, key_len, &TV_DICT_HI2DI(hi)->di_tv); @@ -271,8 +271,7 @@ static int assert_equal_common(typval_T *argvars, assert_type_T atype) { garray_T ga; - if (tv_equal(&argvars[0], &argvars[1], false, false) - != (atype == ASSERT_EQUAL)) { + if (tv_equal(&argvars[0], &argvars[1], false) != (atype == ASSERT_EQUAL)) { prepare_assert_error(&ga); fill_assert_error(&ga, &argvars[2], NULL, &argvars[0], &argvars[1], atype); -- cgit From 4e8efe002e976de1a22dcce6a1e800aeb6acad70 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 10 Aug 2024 06:35:51 +0800 Subject: vim-patch:9.1.0666: assert_equal() doesn't show multibyte string correctly (#30018) Problem: assert_equal() doesn't show multibyte string correctly Solution: Properly advance over a multibyte char. (zeertzjq) closes: vim/vim#15456 https://github.com/vim/vim/commit/9c4b2462bb498f44044616f7309d111d12170369 --- src/nvim/testing.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/nvim/testing.c') diff --git a/src/nvim/testing.c b/src/nvim/testing.c index 4dc8984fa9..adbdd3e611 100644 --- a/src/nvim/testing.c +++ b/src/nvim/testing.c @@ -130,7 +130,7 @@ static void ga_concat_shorten_esc(garray_T *gap, const char *str) return; } - for (const char *p = str; *p != NUL; p++) { + for (const char *p = str; *p != NUL;) { int same_len = 1; const char *s = p; const int c = mb_cptr2char_adv(&s); @@ -146,9 +146,10 @@ static void ga_concat_shorten_esc(garray_T *gap, const char *str) vim_snprintf(buf, NUMBUFLEN, "%d", same_len); ga_concat(gap, buf); ga_concat(gap, " times]"); - p = s - 1; + p = s; } else { ga_concat_esc(gap, p, clen); + p += clen; } } } -- cgit