mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
test(job_spec): Test handling of case-insensitively matching env vars
Since Windows is case-insensitive, there should only be a single env var in visible in the resulting job. However, non-Windows should see both.
This commit is contained in:
@@ -118,6 +118,32 @@ describe('jobs', function()
|
||||
end
|
||||
end)
|
||||
|
||||
it('handles case-insensitively matching #env vars', function()
|
||||
nvim('command', "let $TOTO = 'abc'")
|
||||
-- Since $Toto is being set in the job, it should take precedence over the
|
||||
-- global $TOTO on Windows
|
||||
nvim('command', "let g:job_opts = {'env': {'Toto': 'def'}, 'stdout_buffered': v:true}")
|
||||
if iswin() then
|
||||
nvim('command', [[let j = jobstart('set | find /I "toto="', g:job_opts)]])
|
||||
else
|
||||
nvim('command', [[let j = jobstart('env | grep -i toto=', g:job_opts)]])
|
||||
end
|
||||
nvim('command', "call jobwait([j])")
|
||||
nvim('command', "let g:output = Normalize(g:job_opts.stdout)")
|
||||
local actual = eval('g:output')
|
||||
local expected
|
||||
if iswin() then
|
||||
-- Toto is normalized to TOTO so we can detect duplicates, and because
|
||||
-- Windows doesn't care about case
|
||||
expected = {'TOTO=def', ''}
|
||||
else
|
||||
expected = {'TOTO=abc', 'Toto=def', ''}
|
||||
end
|
||||
table.sort(actual)
|
||||
table.sort(expected)
|
||||
eq(expected, actual)
|
||||
end)
|
||||
|
||||
it('uses &shell and &shellcmdflag if passed a string', function()
|
||||
nvim('command', "let $VAR = 'abc'")
|
||||
if iswin() then
|
||||
|
||||
Reference in New Issue
Block a user