patch 8.2.0239: MS-Windows: 'env' job option does not override existing vars

Problem:    MS-Windows: 'env' job option does not override existing
            environment variables.  (Tim Pope)
Solution:   Set the environment variables later. (Yasuhiro Matsumoto,
            closes #5485, closes #5608)
diff --git a/src/testdir/test_channel.vim b/src/testdir/test_channel.vim
index ebcd76e..16fe5c7 100644
--- a/src/testdir/test_channel.vim
+++ b/src/testdir/test_channel.vim
@@ -2006,3 +2006,12 @@
   sleep 10m
   call assert_equal(-1, job_info(g:job).exitval)
 endfunc
+
+func Test_issue_5485()
+  let $VAR1 = 'global'
+  let g:Ch_reply = ""
+  let l:job = job_start([&shell, &shellcmdflag, has('win32') ? 'echo %VAR1% %VAR2%' : 'echo $VAR1 $VAR2'], {'env': {'VAR1': 'local', 'VAR2': 'local'}, 'callback': 'Ch_handler'})
+  let g:Ch_job = l:job
+  call WaitForAssert({-> assert_equal("local local", trim(g:Ch_reply))})
+  unlet $VAR1
+endfunc