diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-02-09 20:53:59 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-02-09 20:53:59 +0100 |
commit | 5459129af2a832a027a1e7ca2d6177c26647d64f (patch) | |
tree | e001cd02a219302d36cb41ede9fe4c72bdbb9718 /src/testdir/test_getcwd.vim | |
parent | 0d2073773218736e368786f0db7024bd9b9e7912 (diff) | |
download | vim-git-5459129af2a832a027a1e7ca2d6177c26647d64f.tar.gz |
patch 8.0.1489: there is no easy way to get the global directoryv8.0.1489
Problem: There is no easy way to get the global directory, esp. if some
windows have a local directory.
Solution: Make getcwd(-1) return the global directory. (Andy Massimino,
closes #2606)
Diffstat (limited to 'src/testdir/test_getcwd.vim')
-rw-r--r-- | src/testdir/test_getcwd.vim | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/testdir/test_getcwd.vim b/src/testdir/test_getcwd.vim index 15eab2abb..334b89077 100644 --- a/src/testdir/test_getcwd.vim +++ b/src/testdir/test_getcwd.vim @@ -37,6 +37,7 @@ function SetUp() new call mkdir('Xtopdir') cd Xtopdir + let g:topdir = getcwd() call mkdir('Xdir1') call mkdir('Xdir2') call mkdir('Xdir3') @@ -56,36 +57,44 @@ function Test_GetCwd() 3wincmd w lcd Xdir1 call assert_equal("a Xdir1 1", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) wincmd W call assert_equal("b Xtopdir 0", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) wincmd W lcd Xdir3 call assert_equal("c Xdir3 1", GetCwdInfo(0, 0)) call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), 0)) call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), 0)) call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), 0)) + call assert_equal(g:topdir, getcwd(-1)) wincmd W call assert_equal("a Xdir1 1", GetCwdInfo(bufwinnr("a"), tabpagenr())) call assert_equal("b Xtopdir 0", GetCwdInfo(bufwinnr("b"), tabpagenr())) call assert_equal("c Xdir3 1", GetCwdInfo(bufwinnr("c"), tabpagenr())) + call assert_equal(g:topdir, getcwd(-1)) tabnew x new y new z 3wincmd w call assert_equal("x Xtopdir 0", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) wincmd W lcd Xdir2 call assert_equal("y Xdir2 1", GetCwdInfo(0, 0)) + call assert_equal(g:topdir, getcwd(-1)) wincmd W lcd Xdir3 call assert_equal("z Xdir3 1", GetCwdInfo(0, 0)) call assert_equal("x Xtopdir 0", GetCwdInfo(bufwinnr("x"), 0)) call assert_equal("y Xdir2 1", GetCwdInfo(bufwinnr("y"), 0)) call assert_equal("z Xdir3 1", GetCwdInfo(bufwinnr("z"), 0)) + call assert_equal(g:topdir, getcwd(-1)) let tp_nr = tabpagenr() tabrewind call assert_equal("x Xtopdir 0", GetCwdInfo(3, tp_nr)) call assert_equal("y Xdir2 1", GetCwdInfo(2, tp_nr)) call assert_equal("z Xdir3 1", GetCwdInfo(1, tp_nr)) + call assert_equal(g:topdir, getcwd(-1)) endfunc |