aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-01-04 05:22:32 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-01-04 07:23:13 +0100
commit097c8dcccab1f66098e0096c7590ea4eb446dd56 (patch)
tree097dc5fbfe9465816a0651c51d24bf7e7abcb061
parent6ba3b8538245d1176b869734c76f2688709cf106 (diff)
downloadrneovim-097c8dcccab1f66098e0096c7590ea4eb446dd56.tar.gz
rneovim-097c8dcccab1f66098e0096c7590ea4eb446dd56.tar.bz2
rneovim-097c8dcccab1f66098e0096c7590ea4eb446dd56.zip
refactor: Remove VimL function `test_autochdir()`
- Eliminate global test_autochdir. - Eliminate VimL function test_autochdir() - Use a lua test instead. Fails correctly after reverting 0c4347997954 / vim-patch:7.4.2015.
-rw-r--r--runtime/doc/eval.txt5
-rw-r--r--runtime/doc/usr_41.txt1
-rw-r--r--src/nvim/buffer.c2
-rw-r--r--src/nvim/eval.c6
-rw-r--r--src/nvim/eval.lua1
-rw-r--r--src/nvim/globals.h2
-rw-r--r--src/nvim/testdir/Makefile1
-rw-r--r--src/nvim/testdir/test_autochdir.vim17
-rw-r--r--test/functional/legacy/autochdir_spec.lua26
9 files changed, 27 insertions, 34 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 5f283a2f02..0a5a51a0e1 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -2207,7 +2207,6 @@ tagfiles() List tags files used
tan({expr}) Float tangent of {expr}
tanh({expr}) Float hyperbolic tangent of {expr}
tempname() String name for a temporary file
-test_autochdir() none enable 'autochdir' during startup
timer_start({time}, {callback} [, {options}])
Number create a timer
timer_stop({timer}) none stop a timer
@@ -7214,10 +7213,6 @@ tempname() *tempname()* *temp-file-name*
For MS-Windows forward slashes are used when the 'shellslash'
option is set or when 'shellcmdflag' starts with '-'.
-test_autochdir() *test_autochdir()*
- Set a flag to enable the effect of 'autochdir' before Vim
- startup has finished.
-
termopen({cmd}[, {opts}]) {Nvim} *termopen()*
Spawns {cmd} in a new pseudo-terminal session connected
to the current buffer. {cmd} is the same as the one passed to
diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt
index 36a4c2cab4..bf8d31fef9 100644
--- a/runtime/doc/usr_41.txt
+++ b/runtime/doc/usr_41.txt
@@ -904,7 +904,6 @@ Testing: *test-functions*
assert_true() assert that an expression is true
assert_exception() assert that a command throws an exception
assert_fails() assert that a function call fails
- test_autochdir() enable 'autochdir' during startup
Various: *various-functions*
mode() get current editing mode
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 58ec5dc377..d9fdc80c60 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1330,7 +1330,7 @@ void enter_buffer(buf_T *buf)
void do_autochdir(void)
{
if (p_acd) {
- if ((starting == 0 || test_autochdir)
+ if (starting == 0
&& curbuf->b_ffname != NULL
&& vim_chdirfile(curbuf->b_ffname) == OK) {
shorten_fnames(true);
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 48b51f1e9f..32e1991742 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -17159,12 +17159,6 @@ static void f_tempname(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_string = vim_tempname();
}
-// "test_autochdir()" function
-static void f_test_autochdir(typval_T *argvars, typval_T *rettv, FunPtr fptr)
-{
- test_autochdir = true;
-}
-
// "termopen(cmd[, cwd])" function
static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index 9022103c7d..980a8d2326 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -301,7 +301,6 @@ return {
tan={args=1, func="float_op_wrapper", data="&tan"},
tanh={args=1, func="float_op_wrapper", data="&tanh"},
tempname={},
- test_autochdir={},
termopen={args={1, 2}},
test={args=1},
timer_start={args={2,3}},
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index db4600ee4e..fbffc2d44d 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -641,8 +641,6 @@ EXTERN volatile int full_screen INIT(= FALSE);
/* TRUE when doing full-screen output
* otherwise only writing some messages */
-EXTERN int test_autochdir INIT(= false);
-
EXTERN int restricted INIT(= FALSE);
// TRUE when started in restricted mode (-Z)
EXTERN int secure INIT(= FALSE);
diff --git a/src/nvim/testdir/Makefile b/src/nvim/testdir/Makefile
index 5bb7fd1dda..612071e2e2 100644
--- a/src/nvim/testdir/Makefile
+++ b/src/nvim/testdir/Makefile
@@ -30,7 +30,6 @@ SCRIPTS := \
# Tests using runtest.vim.vim.
# Keep test_alot*.res as the last one, sort the others.
NEW_TESTS = \
- test_autochdir.res \
test_bufwintabinfo.res \
test_cmdline.res \
test_cscope.res \
diff --git a/src/nvim/testdir/test_autochdir.vim b/src/nvim/testdir/test_autochdir.vim
deleted file mode 100644
index f52e2e668a..0000000000
--- a/src/nvim/testdir/test_autochdir.vim
+++ /dev/null
@@ -1,17 +0,0 @@
-" Test 'autochdir' behavior
-
-if !exists("+autochdir")
- finish
-endif
-
-func Test_set_filename()
- call test_autochdir()
- set acd
- new
- w samples/Xtest
- call assert_equal("Xtest", expand('%'))
- call assert_equal("samples", substitute(getcwd(), '.*/\(\k*\)', '\1', ''))
- bwipe!
- set noacd
- call delete('samples/Xtest')
-endfunc
diff --git a/test/functional/legacy/autochdir_spec.lua b/test/functional/legacy/autochdir_spec.lua
new file mode 100644
index 0000000000..06f7c1dd11
--- /dev/null
+++ b/test/functional/legacy/autochdir_spec.lua
@@ -0,0 +1,26 @@
+local lfs = require('lfs')
+local helpers = require('test.functional.helpers')(after_each)
+local clear, eq = helpers.clear, helpers.eq
+local eval, execute = helpers.eval, helpers.execute
+
+describe('autochdir behavior', function()
+ local dir = 'Xtest-functional-legacy-autochdir'
+
+ before_each(function()
+ lfs.mkdir(dir)
+ clear()
+ end)
+
+ after_each(function()
+ helpers.rmdir(dir)
+ end)
+
+ -- Tests vim/vim/777 without test_autochdir().
+ it('sets filename', function()
+ execute('set acd')
+ execute('new')
+ execute('w '..dir..'/Xtest')
+ eq('Xtest', eval("expand('%')"))
+ eq(dir, eval([[substitute(getcwd(), '.*[/\\]\(\k*\)', '\1', '')]]))
+ end)
+end)