From 22804c66a536ac7298b89c6ac92b1b29779d186c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 6 Oct 2018 00:19:39 -0400 Subject: vim-patch:8.0.1807: function to set terminal name is too long Problem: Function to set terminal name is too long. Solution: Refactor the function. Fix typo in test. https://github.com/vim/vim/commit/69e056915c4145b7b64c60963797692a5b293561 --- src/nvim/testdir/test_options.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvim/testdir/test_options.vim b/src/nvim/testdir/test_options.vim index 66acb79206..7b640ee2ff 100644 --- a/src/nvim/testdir/test_options.vim +++ b/src/nvim/testdir/test_options.vim @@ -262,7 +262,7 @@ func Test_set_ttytype() " in travis on some builds. Why? Catch both for now try set ttytype= - call assert_report('set ttype= did not fail') + call assert_report('set ttytype= did not fail') catch /E529\|E522/ endtry @@ -270,7 +270,7 @@ func Test_set_ttytype() " check for failure of finding the entry and for missing 'cm' entry. try set ttytype=xxx - call assert_report('set ttype=xxx did not fail') + call assert_report('set ttytype=xxx did not fail') catch /E522\|E437/ endtry -- cgit From ab3a4a489625f7d5af681e07b9339a9ce95ce986 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sat, 6 Oct 2018 11:36:25 -0400 Subject: vim-patch:8.1.0454: resolve() was not tested with a symlink cycle Problem: resolve() was not tested with a symlink cycle. Solution: Add a test. (Dominique Pelle, closes vim/vim#3513) https://github.com/vim/vim/commit/261099070940fb64d4633a766ae3510fffe4171d --- src/nvim/testdir/test_functions.vim | 46 +++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 8fde63b55f..92d966a334 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -189,6 +189,52 @@ func Test_strftime() call assert_fails('call strftime("%Y", [])', 'E745:') endfunc +func Test_resolve() + if !has('unix') + return + endif + + " Xlink1 -> Xlink2 + " Xlink2 -> Xlink3 + silent !ln -s -f Xlink2 Xlink1 + silent !ln -s -f Xlink3 Xlink2 + call assert_equal('Xlink3', resolve('Xlink1')) + call assert_equal('./Xlink3', resolve('./Xlink1')) + call assert_equal('Xlink3/', resolve('Xlink2/')) + " FIXME: these tests result in things like "Xlink2/" instead of "Xlink3/"?! + "call assert_equal('Xlink3/', resolve('Xlink1/')) + "call assert_equal('./Xlink3/', resolve('./Xlink1/')) + "call assert_equal(getcwd() . '/Xlink3/', resolve(getcwd() . '/Xlink1/')) + call assert_equal(getcwd() . '/Xlink3', resolve(getcwd() . '/Xlink1')) + + " Test resolve() with a symlink cycle. + " Xlink1 -> Xlink2 + " Xlink2 -> Xlink3 + " Xlink3 -> Xlink1 + silent !ln -s -f Xlink1 Xlink3 + call assert_fails('call resolve("Xlink1")', 'E655:') + call assert_fails('call resolve("./Xlink1")', 'E655:') + call assert_fails('call resolve("Xlink2")', 'E655:') + call assert_fails('call resolve("Xlink3")', 'E655:') + call delete('Xlink1') + call delete('Xlink2') + call delete('Xlink3') + + silent !ln -s -f Xdir//Xfile Xlink + call assert_equal('Xdir/Xfile', resolve('Xlink')) + call delete('Xlink') + + silent !ln -s -f Xlink2/ Xlink1 + call assert_equal('Xlink2', resolve('Xlink1')) + call assert_equal('Xlink2/', resolve('Xlink1/')) + call delete('Xlink1') + + silent !ln -s -f ./Xlink2 Xlink1 + call assert_equal('Xlink2', resolve('Xlink1')) + call assert_equal('./Xlink2', resolve('./Xlink1')) + call delete('Xlink1') +endfunc + func Test_simplify() call assert_equal('', simplify('')) call assert_equal('/', simplify('/')) -- cgit From f25f42bf03b6cdc50dd85ec1dddd693aa71b6f50 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Sun, 7 Oct 2018 10:29:57 -0400 Subject: vim-patch:8.1.0453: MS-Windows: executable() is not reliable Problem: MS-Windows: executable() is not reliable. Solution: Use $PATHEXT properly. (Yasuhiro Matsumoto, closes vim/vim#3412) https://github.com/vim/vim/commit/8295666dc2c65e42135b91d5c61e2a140d002333 --- src/nvim/testdir/test_functions.vim | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index 92d966a334..acbbd522db 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -864,6 +864,19 @@ func Test_filewritable() bw! endfunc +func Test_Executable() + if has('win32') + call assert_equal(1, executable('notepad')) + call assert_equal(1, executable('notepad.exe')) + call assert_equal(0, executable('notepad.exe.exe')) + call assert_equal(0, executable('shell32.dll')) + call assert_equal(0, executable('win.ini')) + elseif has('unix') + call assert_equal(1, executable('cat')) + call assert_equal(0, executable('dog')) + endif +endfunc + func Test_hostname() let hostname_vim = hostname() if has('unix') -- cgit From 1892d28c60e97e6e54ebb8bed43e42751178cbcf Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 8 Oct 2018 12:34:22 -0400 Subject: oldtests: win: fix executable() assertions Windows has "Read and execute" permission via ACL but nvim and libuv do not support ACL. Windows does not support the executable bit in chmod-style permissions but it is safe to assume that if the file exists and is readable, then it is most likely executable. This means that win.ini and shell32.dll are "executable" because they exist, are readable, and are in PATH. PATHEXT does not affect the executable permission of a file; it exists to run files on the shell while omitting the file extension. Assume that PATHEXT is intended for cmd.exe only because powershell can execute powershell files (ie. *.ps1) without changing PATHEXT or related cmd.exe environment variable. In the future, nvim should check the outputs of 'assoc' and 'ftype', cmd.exe internal commands, or check the registry. Powershell can be used for ACL if C++/C# API is too difficult to use. --- src/nvim/testdir/test_functions.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim index acbbd522db..4a27a119f3 100644 --- a/src/nvim/testdir/test_functions.vim +++ b/src/nvim/testdir/test_functions.vim @@ -869,8 +869,8 @@ func Test_Executable() call assert_equal(1, executable('notepad')) call assert_equal(1, executable('notepad.exe')) call assert_equal(0, executable('notepad.exe.exe')) - call assert_equal(0, executable('shell32.dll')) - call assert_equal(0, executable('win.ini')) + call assert_equal(1, executable('shell32.dll')) + call assert_equal(1, executable('win.ini')) elseif has('unix') call assert_equal(1, executable('cat')) call assert_equal(0, executable('dog')) -- cgit