To: vim_dev@googlegroups.com Subject: Patch 8.1.2230 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.1.2230 Problem: MS-Windows: testing external commands can be improved. Solution: Adjust tests, remove duplicate test. (closes #4928) Files: src/testdir/test_normal.vim, src/testdir/test_system.vim, src/testdir/test_terminal.vim, src/testdir/test_undo.vim *** ../vim-8.1.2229/src/testdir/test_normal.vim 2019-10-12 16:12:50.968492825 +0200 --- src/testdir/test_normal.vim 2019-10-28 00:33:37.763671386 +0100 *************** *** 408,415 **** if executable('echo') " Test expand(`...`) i.e. backticks command expansion. ! " MS-Windows has a trailing space. ! call assert_match('^abcde *$', expand('`echo abcde`')) endif " Test expand(`=...`) i.e. backticks expression expansion --- 408,414 ---- if executable('echo') " Test expand(`...`) i.e. backticks command expansion. ! call assert_equal('abcde', expand('`echo abcde`')) endif " Test expand(`=...`) i.e. backticks expression expansion *** ../vim-8.1.2229/src/testdir/test_system.vim 2019-10-05 12:09:21.262785409 +0200 --- src/testdir/test_system.vim 2019-10-28 00:33:37.763671386 +0100 *************** *** 18,61 **** call assert_equal(["as\r", "df\r"], systemlist('more', ["as\df"])) endif - if !executable('cat') || !executable('wc') - return - endif - - let out = 'echo 123'->system() - " On Windows we may get a trailing space. - if out != "123 \n" - call assert_equal("123\n", out) - endif - - let out = 'echo 123'->systemlist() - if !has('win32') - call assert_equal(["123"], out) - else - call assert_equal(["123\r"], out) - endif - - if executable('cat') - call assert_equal('123', system('cat', '123')) - call assert_equal(['123'], systemlist('cat', '123')) - call assert_equal(["as\df"], systemlist('cat', ["as\df"])) - endif - new Xdummy call setline(1, ['asdf', "pw\er", 'xxxx']) - let out = system('wc -l', bufnr('%')) - " On OS/X we get leading spaces - let out = substitute(out, '^ *', '', '') - call assert_equal("3\n", out) ! let out = systemlist('wc -l', bufnr('%')) ! " On Windows we may get a trailing CR. ! if out != ["3\r"] " On OS/X we get leading spaces ! if type(out) == v:t_list ! let out[0] = substitute(out[0], '^ *', '', '') endif - call assert_equal(['3'], out) endif if !has('win32') --- 18,41 ---- call assert_equal(["as\r", "df\r"], systemlist('more', ["as\df"])) endif new Xdummy call setline(1, ['asdf', "pw\er", 'xxxx']) ! if executable('wc') ! let out = system('wc -l', bufnr('%')) " On OS/X we get leading spaces ! let out = substitute(out, '^ *', '', '') ! call assert_equal("3\n", out) ! ! let out = systemlist('wc -l', bufnr('%')) ! " On Windows we may get a trailing CR. ! if out != ["3\r"] ! " On OS/X we get leading spaces ! if type(out) == v:t_list ! let out[0] = substitute(out[0], '^ *', '', '') ! endif ! call assert_equal(['3'], out) endif endif if !has('win32') *** ../vim-8.1.2229/src/testdir/test_terminal.vim 2019-10-26 16:21:34.511468348 +0200 --- src/testdir/test_terminal.vim 2019-10-28 00:33:37.763671386 +0100 *************** *** 563,573 **** endfunc func Test_terminal_cwd() ! if !executable('pwd') ! return endif call mkdir('Xdir') ! let buf = term_start('pwd', {'cwd': 'Xdir'}) call WaitForAssert({-> assert_equal('Xdir', fnamemodify(getline(1), ":t"))}) exe buf . 'bwipe' --- 563,576 ---- endfunc func Test_terminal_cwd() ! if has('win32') ! let cmd = 'cmd /c cd' ! else ! CheckExecutable pwd ! let cmd = 'pwd' endif call mkdir('Xdir') ! let buf = term_start(cmd, {'cwd': 'Xdir'}) call WaitForAssert({-> assert_equal('Xdir', fnamemodify(getline(1), ":t"))}) exe buf . 'bwipe' *************** *** 2031,2037 **** endfunc func Test_terminal_no_job() ! let term = term_start('false', {'term_finish': 'close'}) call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) }) endfunc --- 2034,2046 ---- endfunc func Test_terminal_no_job() ! if has('win32') ! let cmd = 'cmd /c ""' ! else ! CheckExecutable false ! let cmd = 'false' ! endif ! let term = term_start(cmd, {'term_finish': 'close'}) call WaitForAssert({-> assert_equal(v:null, term_getjob(term)) }) endfunc *** ../vim-8.1.2229/src/testdir/test_undo.vim 2019-09-13 21:48:31.157633858 +0200 --- src/testdir/test_undo.vim 2019-10-28 00:33:37.763671386 +0100 *************** *** 458,464 **** " Test undofile() with 'undodir' set to a non-existing directory. call assert_equal('', 'Xundofoo'->undofile()) ! if isdirectory('/tmp') set undodir=/tmp if has('osx') call assert_equal('/tmp/%private%tmp%file', undofile('///tmp/file')) --- 458,464 ---- " Test undofile() with 'undodir' set to a non-existing directory. call assert_equal('', 'Xundofoo'->undofile()) ! if !has('win32') && isdirectory('/tmp') set undodir=/tmp if has('osx') call assert_equal('/tmp/%private%tmp%file', undofile('///tmp/file')) *** ../vim-8.1.2229/src/version.c 2019-10-27 22:54:24.583870611 +0100 --- src/version.c 2019-10-28 00:34:21.299486774 +0100 *************** *** 743,744 **** --- 743,746 ---- { /* Add new patch number below this line */ + /**/ + 2230, /**/ -- I learned the customs and mannerisms of engineers by observing them, much the way Jane Goodall learned about the great apes, but without the hassle of grooming. (Scott Adams - The Dilbert principle) /// 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 ///