diff options
author | Josh Rahm <rahm@google.com> | 2022-07-18 19:37:18 +0000 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2022-07-18 19:37:18 +0000 |
commit | 308e1940dcd64aa6c344c403d4f9e0dda58d9c5c (patch) | |
tree | 35fe43e01755e0f312650667004487a44d6b7941 /test/functional/options/autochdir_spec.lua | |
parent | 96a00c7c588b2f38a2424aeeb4ea3581d370bf2d (diff) | |
parent | e8c94697bcbe23a5c7b07c292b90a6b70aadfa87 (diff) | |
download | rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.gz rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.bz2 rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.zip |
Merge remote-tracking branch 'upstream/master' into rahm
Diffstat (limited to 'test/functional/options/autochdir_spec.lua')
-rw-r--r-- | test/functional/options/autochdir_spec.lua | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/test/functional/options/autochdir_spec.lua b/test/functional/options/autochdir_spec.lua index 2fce0a5ed9..74959a8e76 100644 --- a/test/functional/options/autochdir_spec.lua +++ b/test/functional/options/autochdir_spec.lua @@ -1,7 +1,9 @@ +local lfs = require('lfs') local helpers = require('test.functional.helpers')(after_each) local clear = helpers.clear local eq = helpers.eq -local getcwd = helpers.funcs.getcwd +local funcs = helpers.funcs +local command = helpers.command describe("'autochdir'", function() it('given on the shell gets processed properly', function() @@ -9,11 +11,34 @@ describe("'autochdir'", function() -- By default 'autochdir' is off, thus getcwd() returns the repo root. clear(targetdir..'/tty-test.c') - local rootdir = getcwd() + local rootdir = funcs.getcwd() local expected = rootdir .. '/' .. targetdir -- With 'autochdir' on, we should get the directory of tty-test.c. clear('--cmd', 'set autochdir', targetdir..'/tty-test.c') - eq(helpers.iswin() and expected:gsub('/', '\\') or expected, getcwd()) + eq(helpers.iswin() and expected:gsub('/', '\\') or expected, funcs.getcwd()) + end) + + it('is not overwritten by getwinvar() call #17609',function() + local curdir = string.gsub(lfs.currentdir(), '\\', '/') + local dir_a = curdir..'/Xtest-functional-options-autochdir.dir_a' + local dir_b = curdir..'/Xtest-functional-options-autochdir.dir_b' + lfs.mkdir(dir_a) + lfs.mkdir(dir_b) + clear() + command('set shellslash') + command('set autochdir') + command('edit '..dir_a..'/file1') + eq(dir_a, funcs.getcwd()) + command('lcd '..dir_b) + eq(dir_b, funcs.getcwd()) + command('botright vnew ../file2') + eq(curdir, funcs.getcwd()) + command('wincmd w') + eq(dir_a, funcs.getcwd()) + funcs.getwinvar(2, 'foo') + eq(dir_a, funcs.getcwd()) + helpers.rmdir(dir_a) + helpers.rmdir(dir_b) end) end) |