aboutsummaryrefslogtreecommitdiff
path: root/test/functional/vimscript/let_spec.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2026-08-04 07:06:47 -0400
committerGitHub <noreply@github.com>2026-08-04 11:06:47 +0000
commit597555ebc09dd5bf7b0349b27cdcb308638d79ce (patch)
treedb2482f0a3ea44debe7e42142b7990f0a4cc8a47 /test/functional/vimscript/let_spec.lua
parentdab5fab948aeb54045d0b63d23f67774cf76e4ad (diff)
downloadrneovim-597555ebc09dd5bf7b0349b27cdcb308638d79ce.tar.gz
rneovim-597555ebc09dd5bf7b0349b27cdcb308638d79ce.tar.bz2
rneovim-597555ebc09dd5bf7b0349b27cdcb308638d79ce.zip
fix(options): crash on ":let &t_Co = v:true" #41152
Problem: Assigning a Boolean or special value (v:true/v:false/v:null/v:none) to a TTY option aborts: Assertion failed: (curval.type == newval.type), function ex_let_option, file vars.c, line 1408. 3 libsystem_c.dylib __assert_rtn + 284 4 nvim ex_let_one + 3308 5 nvim ex_let_vars + 112 6 nvim ex_let + 2356 7 nvim execute_cmd0 + 252 8 nvim do_cmdline + 9076 9 nvim call_user_func + 3320 10 nvim call_func + 2076 11 nvim get_func_tv + 696 12 nvim eval_func + 380 20 nvim eval_to_string_eap + 276 21 nvim eval_map_expr + 444 22 nvim vgetorpeek + 3172 23 nvim vgetc + 764 Solution: Apply the string-type check to TTY options too, so a Boolean/special value gives "E928: String required" instead of aborting. Valid string/number assignments to `t_*` pseudo-options still silently no-op.
Diffstat (limited to 'test/functional/vimscript/let_spec.lua')
-rw-r--r--test/functional/vimscript/let_spec.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/functional/vimscript/let_spec.lua b/test/functional/vimscript/let_spec.lua
index 1cd12f42d1..54153db049 100644
--- a/test/functional/vimscript/let_spec.lua
+++ b/test/functional/vimscript/let_spec.lua
@@ -114,6 +114,15 @@ describe(':let', function()
command('let &equalalways %= 1')
eq(false, api.nvim_get_option_value('equalalways', {}))
end)
+
+ it('assigning bool/special to a string option gives E928, not a crash', function()
+ for _, v in ipairs({ 'v:true', 'v:false', 'v:null' }) do
+ -- Regular string option.
+ eq('Vim(let):E928: String required', t.pcall_err(command, 'let &makeprg = ' .. v))
+ -- TTY option ("t_" pseudo-option).
+ eq('Vim(let):E928: String required', t.pcall_err(command, 'let &t_Co = ' .. v))
+ end
+ end)
end)
describe(':let and :const', function()