comparison src/evalvars.c @ 21265:6a4806e326dd v8.2.1183

patch 8.2.1183: assert_fails() checks the last error message Commit: https://github.com/vim/vim/commit/9b7bf9e98f06ece595fed7a3ff53ecce89797a53 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jul 11 22:14:59 2020 +0200 patch 8.2.1183: assert_fails() checks the last error message Problem: assert_fails() checks the last error message. Solution: Check the first error, it is more relevant. Fix all the tests that rely on the old behavior.
author Bram Moolenaar <Bram@vim.org>
date Sat, 11 Jul 2020 22:30:07 +0200
parents caab594592cc
children 7833afe1c66e
comparison
equal deleted inserted replaced
21264:f3bdfe1d9359 21265:6a4806e326dd
3386 * Returns OK if successfully completed the setup. FAIL otherwise. 3386 * Returns OK if successfully completed the setup. FAIL otherwise.
3387 */ 3387 */
3388 int 3388 int
3389 var_redir_start(char_u *name, int append) 3389 var_redir_start(char_u *name, int append)
3390 { 3390 {
3391 int save_emsg; 3391 int called_emsg_before;
3392 int err; 3392 int err;
3393 typval_T tv; 3393 typval_T tv;
3394 3394
3395 // Catch a bad name early. 3395 // Catch a bad name early.
3396 if (!eval_isnamec1(*name)) 3396 if (!eval_isnamec1(*name))
3430 return FAIL; 3430 return FAIL;
3431 } 3431 }
3432 3432
3433 // check if we can write to the variable: set it to or append an empty 3433 // check if we can write to the variable: set it to or append an empty
3434 // string 3434 // string
3435 save_emsg = did_emsg; 3435 called_emsg_before = called_emsg;
3436 did_emsg = FALSE;
3437 tv.v_type = VAR_STRING; 3436 tv.v_type = VAR_STRING;
3438 tv.vval.v_string = (char_u *)""; 3437 tv.vval.v_string = (char_u *)"";
3439 if (append) 3438 if (append)
3440 set_var_lval(redir_lval, redir_endp, &tv, TRUE, 0, (char_u *)"."); 3439 set_var_lval(redir_lval, redir_endp, &tv, TRUE, 0, (char_u *)".");
3441 else 3440 else
3442 set_var_lval(redir_lval, redir_endp, &tv, TRUE, 0, (char_u *)"="); 3441 set_var_lval(redir_lval, redir_endp, &tv, TRUE, 0, (char_u *)"=");
3443 clear_lval(redir_lval); 3442 clear_lval(redir_lval);
3444 err = did_emsg; 3443 if (called_emsg > called_emsg_before)
3445 did_emsg |= save_emsg;
3446 if (err)
3447 { 3444 {
3448 redir_endp = NULL; // don't store a value, only cleanup 3445 redir_endp = NULL; // don't store a value, only cleanup
3449 var_redir_stop(); 3446 var_redir_stop();
3450 return FAIL; 3447 return FAIL;
3451 } 3448 }