refactor: Remove VimL function test_autochdir()

- Eliminate global test_autochdir.
- Eliminate VimL function test_autochdir()
- Use a lua test instead. Fails correctly after reverting
  0c43479979 / vim-patch:7.4.2015.
This commit is contained in:
Justin M. Keyes
2017-01-04 05:22:32 +01:00
parent 6ba3b85382
commit 097c8dccca
9 changed files with 27 additions and 34 deletions

View File

@@ -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);

View File

@@ -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)
{

View File

@@ -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}},

View File

@@ -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);

View File

@@ -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 \

View File

@@ -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