aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/testdir/test_functions.vim59
-rw-r--r--src/nvim/testdir/test_options.vim4
2 files changed, 61 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_functions.vim b/src/nvim/testdir/test_functions.vim
index 8fde63b55f..4a27a119f3 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('/'))
@@ -818,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(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'))
+ endif
+endfunc
+
func Test_hostname()
let hostname_vim = hostname()
if has('unix')
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