diff options
author | James McCoy <jamessan@jamessan.com> | 2021-05-13 20:56:25 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2021-05-18 06:53:03 -0400 |
commit | d250905c69c0a8d2ac99c4ade9cfb574a011faaf (patch) | |
tree | 24d4cee5cc9576fe0e78598d0819483f7944bb78 /test/functional/core/job_spec.lua | |
parent | e0a01bdf7ff05770a535a2dc68eed367669859ad (diff) | |
download | rneovim-d250905c69c0a8d2ac99c4ade9cfb574a011faaf.tar.gz rneovim-d250905c69c0a8d2ac99c4ade9cfb574a011faaf.tar.bz2 rneovim-d250905c69c0a8d2ac99c4ade9cfb574a011faaf.zip |
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.
Diffstat (limited to 'test/functional/core/job_spec.lua')
-rw-r--r-- | test/functional/core/job_spec.lua | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/functional/core/job_spec.lua b/test/functional/core/job_spec.lua index 9de0d08e79..34ab90d760 100644 --- a/test/functional/core/job_spec.lua +++ b/test/functional/core/job_spec.lua @@ -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 |