aboutsummaryrefslogtreecommitdiff
path: root/test/functional/eval/let_spec.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/eval/let_spec.lua')
-rw-r--r--test/functional/eval/let_spec.lua39
1 files changed, 38 insertions, 1 deletions
diff --git a/test/functional/eval/let_spec.lua b/test/functional/eval/let_spec.lua
index 1bd3405698..0cbf40137e 100644
--- a/test/functional/eval/let_spec.lua
+++ b/test/functional/eval/let_spec.lua
@@ -2,13 +2,16 @@ local helpers = require('test.functional.helpers')(after_each)
local eq = helpers.eq
local clear = helpers.clear
+local command = helpers.command
+local eval = helpers.eval
local meths = helpers.meths
local redir_exec = helpers.redir_exec
local source = helpers.source
+local nvim_dir = helpers.nvim_dir
before_each(clear)
-describe(':let command', function()
+describe(':let', function()
it('correctly lists variables with curly-braces', function()
meths.set_var('v', {0})
eq('\nv [0]', redir_exec('let {"v"}'))
@@ -42,4 +45,38 @@ describe(':let command', function()
call feedkeys(":\e:echo l1 l3\n:echo 42\n:cq\n", "t")
]=])
end)
+
+ it("multibyte env var #8398 #9267", function()
+ command("let $NVIM_TEST = 'AìaB'")
+ eq('AìaB', eval('$NVIM_TEST'))
+ command("let $NVIM_TEST = 'AaあB'")
+ eq('AaあB', eval('$NVIM_TEST'))
+ local mbyte = [[\p* .ม .ม .ม .ม่ .ม่ .ม่ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹֻ ֹֻ ֹֻ
+ .ֹֻ .ֹֻ .ֹֻ ֹֻ ֹֻ ֹֻ .ֹֻ .ֹֻ .ֹֻ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹֻ ֹֻ
+ .ֹֻ .ֹֻ .ֹֻ a a a ca ca ca à à à]]
+ command("let $NVIM_TEST = '"..mbyte.."'")
+ eq(mbyte, eval('$NVIM_TEST'))
+ end)
+
+ it("multibyte env var to child process #8398 #9267", function()
+ if (not helpers.iswin()) and require('test.helpers').isCI() then
+ -- Fails on non-Windows CI. Buffering/timing issue?
+ pending('fails on unix CI', function() end)
+ end
+ local cmd_get_child_env = "let g:env_from_child = system(['"..nvim_dir.."/printenv-test', 'NVIM_TEST'])"
+ command("let $NVIM_TEST = 'AìaB'")
+ command(cmd_get_child_env)
+ eq(eval('$NVIM_TEST'), eval('g:env_from_child'))
+
+ command("let $NVIM_TEST = 'AaあB'")
+ command(cmd_get_child_env)
+ eq(eval('$NVIM_TEST'), eval('g:env_from_child'))
+
+ local mbyte = [[\p* .ม .ม .ม .ม่ .ม่ .ม่ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹֻ ֹֻ ֹֻ
+ .ֹֻ .ֹֻ .ֹֻ ֹֻ ֹֻ ֹֻ .ֹֻ .ֹֻ .ֹֻ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹֻ ֹֻ
+ .ֹֻ .ֹֻ .ֹֻ a a a ca ca ca à à à]]
+ command("let $NVIM_TEST = '"..mbyte.."'")
+ command(cmd_get_child_env)
+ eq(eval('$NVIM_TEST'), eval('g:env_from_child'))
+ end)
end)