From 9153062095f34ec8dcdc8862da1ab9abfe560e3f Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sat, 27 Jan 2018 12:50:10 +0100 Subject: os_setenv: use _wputenv_s; remove vestigial code #7920 _putenv_s variant was left over from 810d31a43001, should have been removed in cd5b1315757e. --- test/functional/eval/let_spec.lua | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'test/functional/eval') diff --git a/test/functional/eval/let_spec.lua b/test/functional/eval/let_spec.lua index 1bd3405698..050cff3c22 100644 --- a/test/functional/eval/let_spec.lua +++ b/test/functional/eval/let_spec.lua @@ -2,13 +2,15 @@ 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 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 +44,16 @@ describe(':let command', function() call feedkeys(":\e:echo l1 l3\n:echo 42\n:cq\n", "t") ]=]) end) + + it("sets environment variables", function() + local multibyte_multiline = [[\p* .ม .ม .ม .ม่ .ม่ .ม่ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹֻ ֹֻ ֹֻ + .ֹֻ .ֹֻ .ֹֻ ֹֻ ֹֻ ֹֻ .ֹֻ .ֹֻ .ֹֻ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹֻ ֹֻ + .ֹֻ .ֹֻ .ֹֻ a a a ca ca ca à à à]] + command("let $NVIM_TEST1 = 'AìaB'") + command("let $NVIM_TEST2 = 'AaあB'") + command("let $NVIM_TEST3 = '"..multibyte_multiline.."'") + eq('AìaB', eval('$NVIM_TEST1')) + eq('AaあB', eval('$NVIM_TEST2')) + eq(multibyte_multiline, eval('$NVIM_TEST3')) + end) end) -- cgit From 1d8e7683604828592bd41cdac5a351145cd93487 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 28 Jan 2018 11:02:15 +0100 Subject: os_getenv, os_setenv: revert "widechar" impl It's reported that the Windows widechar variants do automatically convert from the current codepage to UTF16, which is very helpful. So the "widechar" impls are a good direction. But libuv v1.12 does that for us, so the next commit will use that instead. ref #8398 ref #9267 --- test/functional/eval/let_spec.lua | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'test/functional/eval') diff --git a/test/functional/eval/let_spec.lua b/test/functional/eval/let_spec.lua index 050cff3c22..ff71daab74 100644 --- a/test/functional/eval/let_spec.lua +++ b/test/functional/eval/let_spec.lua @@ -45,15 +45,15 @@ describe(':let', function() ]=]) end) - it("sets environment variables", function() - local multibyte_multiline = [[\p* .ม .ม .ม .ม่ .ม่ .ม่ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹֻ ֹֻ ֹֻ - .ֹֻ .ֹֻ .ֹֻ ֹֻ ֹֻ ֹֻ .ֹֻ .ֹֻ .ֹֻ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹ ֹ ֹ .ֹ .ֹ .ֹ ֹֻ ֹֻ - .ֹֻ .ֹֻ .ֹֻ a a a ca ca ca à à à]] - command("let $NVIM_TEST1 = 'AìaB'") - command("let $NVIM_TEST2 = 'AaあB'") - command("let $NVIM_TEST3 = '"..multibyte_multiline.."'") - eq('AìaB', eval('$NVIM_TEST1')) - eq('AaあB', eval('$NVIM_TEST2')) - eq(multibyte_multiline, eval('$NVIM_TEST3')) + it("multibyte environment variables", 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) end) -- cgit From 67535b5940b70de327d1a9ce6af4a311406eb62f Mon Sep 17 00:00:00 2001 From: erw7 Date: Thu, 28 Feb 2019 08:34:10 +0100 Subject: test/env: multibyte env var to child process Note: the test fails on non-Windows CI (Travis linux, Quickbuild bsd): even on master before the env.c changes in this patch-series. Maybe the unix part of printenv-test.c needs to be revisited. Signed-off-by: Justin M. Keyes --- test/functional/eval/let_spec.lua | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'test/functional/eval') diff --git a/test/functional/eval/let_spec.lua b/test/functional/eval/let_spec.lua index ff71daab74..0cbf40137e 100644 --- a/test/functional/eval/let_spec.lua +++ b/test/functional/eval/let_spec.lua @@ -7,6 +7,7 @@ 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) @@ -45,7 +46,7 @@ describe(':let', function() ]=]) end) - it("multibyte environment variables", function() + 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'") @@ -56,4 +57,26 @@ describe(':let', function() 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) -- cgit