patch 7.4.2015
Problem: When a file gets a name when writing it 'acd' is not effective.
(Dan Church)
Solution: Invoke DO_AUTOCHDIR after writing the file. (Allen Haim, closes
#777, closes #803) Add test_autochdir() to enable 'acd' before
"starting" is reset.
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 88efd19..dabf573 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -164,6 +164,7 @@
# Keep test_alot*.res as the last one, sort the others.
NEW_TESTS = test_arglist.res \
test_assert.res \
+ test_autochdir \
test_backspace_opt.res \
test_cdo.res \
test_channel.res \
diff --git a/src/testdir/test_autochdir.vim b/src/testdir/test_autochdir.vim
new file mode 100644
index 0000000..f52e2e6
--- /dev/null
+++ b/src/testdir/test_autochdir.vim
@@ -0,0 +1,17 @@
+" 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