To: vim_dev@googlegroups.com Subject: Patch 8.0.1017 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.0.1017 Problem: Test for MS-Windows $HOME always passes. Solution: Rename the test function. Make the test pass. Files: src/testdir/test_windows_home.vim *** ../vim-8.0.1016/src/testdir/test_windows_home.vim 2017-08-29 21:44:55.079627984 +0200 --- src/testdir/test_windows_home.vim 2017-08-30 14:49:56.148695623 +0200 *************** *** 38,113 **** endfunc func CheckHome(exp, ...) ! "call assert_equal(a:exp, $HOME) ! "call assert_equal(a:exp, expand('~', ':p')) if !a:0 call CheckHomeIsMissingFromSubprocessEnvironment() else ! call CheckHomeIsInSubprocessEnvironment(a:exp) endif endfunc ! func TestWindowsHome() command! -nargs=* SaveEnv call save_env() command! -nargs=* RestoreEnv call restore_env() command! -nargs=* UnletEnv call unlet_env() ! SaveEnv $HOME $USERPROFILE $HOMEDRIVE $HOMEPATH try ! RestoreEnv ! UnletEnv $HOME $USERPROFILE $HOMEPATH ! let $HOMEDRIVE = 'C:' ! call CheckHome('C:\') ! ! RestoreEnv ! UnletEnv $HOME $USERPROFILE let $HOMEDRIVE = 'C:' let $HOMEPATH = '\foobar' call CheckHome('C:\foobar') ! RestoreEnv ! UnletEnv $HOME $HOMEDRIVE $HOMEPATH ! let $USERPROFILE = 'C:\foo' ! call CheckHome('C:\foo') ! RestoreEnv ! UnletEnv $HOME let $USERPROFILE = 'C:\foo' ! let $HOMEDRIVE = 'C:' ! let $HOMEPATH = '\baz' call CheckHome('C:\foo') ! RestoreEnv let $HOME = 'C:\bar' ! let $USERPROFILE = 'C:\foo' ! let $HOMEDRIVE = 'C:' ! let $HOMEPATH = '\baz' ! call CheckHome('C:\bar', 1) ! RestoreEnv ! let $HOME = '%USERPROFILE%\bar' let $USERPROFILE = 'C:\foo' ! let $HOMEDRIVE = 'C:' ! let $HOMEPATH = '\baz' ! call CheckHome('%USERPROFILE%\bar', 1) ! RestoreEnv ! let $HOME = '%USERPROFILE' let $USERPROFILE = 'C:\foo' ! let $HOMEDRIVE = 'C:' ! let $HOMEPATH = '\baz' ! call CheckHome('%USERPROFILE', 1) ! RestoreEnv let $HOME = 'C:\%USERPROFILE%' ! let $USERPROFILE = 'C:\foo' ! let $HOMEDRIVE = 'C:' ! let $HOMEPATH = '\baz' ! call CheckHome('C:\%USERPROFILE%', 1) if has('channel') RestoreEnv ! UnletEnv $HOME let env = '' let job = job_start('cmd /c set', {'out_cb': {ch,x->[env,execute('let env=x')]}}) sleep 1 --- 38,110 ---- endfunc func CheckHome(exp, ...) ! call assert_equal(a:exp, $HOME) ! call assert_equal(a:exp, expand('~', ':p')) if !a:0 call CheckHomeIsMissingFromSubprocessEnvironment() else ! call CheckHomeIsInSubprocessEnvironment(a:1) endif endfunc ! func Test_WindowsHome() command! -nargs=* SaveEnv call save_env() command! -nargs=* RestoreEnv call restore_env() command! -nargs=* UnletEnv call unlet_env() + set noshellslash ! let save_home = $HOME ! SaveEnv $USERPROFILE $HOMEDRIVE $HOMEPATH try ! " Normal behavior: use $HOMEDRIVE and $HOMEPATH, ignore $USERPROFILE ! let $USERPROFILE = 'unused' let $HOMEDRIVE = 'C:' let $HOMEPATH = '\foobar' + let $HOME = '' " Force recomputing "homedir" call CheckHome('C:\foobar') ! " Same, but with $HOMEPATH not set ! UnletEnv $HOMEPATH ! let $HOME = '' " Force recomputing "homedir" ! call CheckHome('C:\') ! " Use $USERPROFILE if $HOMEPATH and $HOMEDRIVE are empty ! UnletEnv $HOMEDRIVE $HOMEPATH let $USERPROFILE = 'C:\foo' ! let $HOME = '' " Force recomputing "homedir" call CheckHome('C:\foo') ! " If $HOME is set the others don't matter let $HOME = 'C:\bar' ! let $USERPROFILE = 'unused' ! let $HOMEDRIVE = 'unused' ! let $HOMEPATH = 'unused' ! call CheckHome('C:\bar', 'C:\bar') ! " If $HOME contains %USERPROFILE% it is expanded let $USERPROFILE = 'C:\foo' ! let $HOME = '%USERPROFILE%\bar' ! let $HOMEDRIVE = 'unused' ! let $HOMEPATH = 'unused' ! call CheckHome('C:\foo\bar', '%USERPROFILE%\bar') ! " Invalid $HOME is kept let $USERPROFILE = 'C:\foo' ! let $HOME = '%USERPROFILE' ! let $HOMEDRIVE = 'unused' ! let $HOMEPATH = 'unused' ! call CheckHome('%USERPROFILE', '%USERPROFILE') ! " %USERPROFILE% not at start of $HOME is not expanded ! let $USERPROFILE = 'unused' let $HOME = 'C:\%USERPROFILE%' ! let $HOMEDRIVE = 'unused' ! let $HOMEPATH = 'unused' ! call CheckHome('C:\%USERPROFILE%', 'C:\%USERPROFILE%') if has('channel') RestoreEnv ! let $HOME = save_home let env = '' let job = job_start('cmd /c set', {'out_cb': {ch,x->[env,execute('let env=x')]}}) sleep 1 *** ../vim-8.0.1016/src/version.c 2017-08-30 14:53:02.815426509 +0200 --- src/version.c 2017-08-30 14:54:25.898861930 +0200 *************** *** 771,772 **** --- 771,774 ---- { /* Add new patch number below this line */ + /**/ + 1017, /**/ -- hundred-and-one symptoms of being an internet addict: 32. You don't know what sex three of your closest friends are, because they have neutral nicknames and you never bothered to ask. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///