aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/testdir/test_cscope.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_cscope.vim b/src/nvim/testdir/test_cscope.vim
index 01a9a3f9ad..bcb0d0dec5 100644
--- a/src/nvim/testdir/test_cscope.vim
+++ b/src/nvim/testdir/test_cscope.vim
@@ -254,7 +254,30 @@ func Test_cscopeWithCscopeConnections()
" CleanUp
call CscopeSetupOrClean(0)
+endfunc
+
+" Test ":cs add {dir}" (add the {dir}/cscope.out database)
+func Test_cscope_add_dir()
+ call mkdir('Xcscopedir', 'p')
+
+ " Cscope doesn't handle symlinks, so this needs to be resolved in case a
+ " shadow directory is being used.
+ let memfile = resolve('./samples/memfile_test.c')
+ call system('cscope -bk -fXcscopedir/cscope.out ' . memfile)
+
+ cs add Xcscopedir
+ let a = execute('cscope show')
+ let lines = split(a, "\n", 1)
+ call assert_equal(3, len(lines))
+ call assert_equal(' # pid database name prepend path', lines[0])
+ call assert_equal('', lines[1])
+ call assert_match('^ 0 \d\+.*Xcscopedir/cscope.out\s\+<none>$', lines[2])
+
+ cs kill -1
+ call delete('Xcscopedir/cscope.out')
+ call assert_fails('cs add Xcscopedir', 'E563:')
+ call delete('Xcscopedir', 'd')
endfunc
func Test_cscopequickfix()