patch 7.4.1108
Problem:    Expanding "~" halfway a file name.
Solution:   Handle the file name as one name. (Marco Hinz)  Add a test.
            Closes #564.
diff --git a/src/testdir/test27.in b/src/testdir/test27.in
deleted file mode 100644
index 2df16d9..0000000
--- a/src/testdir/test27.in
+++ /dev/null
@@ -1,20 +0,0 @@
-Test for expanding file names
-
-STARTTEST
-:!mkdir Xdir1
-:!mkdir Xdir2
-:!mkdir Xdir3
-:cd Xdir3
-:!mkdir Xdir4
-:cd ..
-:w Xdir1/file
-:w Xdir3/Xdir4/file
-:n Xdir?/*/file
-Go%:.w! test.out
-:n! Xdir?/*/nofile
-Go%:.w >>test.out
-:e! xx
-:!rm -rf Xdir1 Xdir2 Xdir3
-:qa!
-ENDTEST
-
diff --git a/src/testdir/test27.ok b/src/testdir/test27.ok
deleted file mode 100644
index c35f243..0000000
--- a/src/testdir/test27.ok
+++ /dev/null
@@ -1,2 +0,0 @@
-Xdir3/Xdir4/file
-Xdir?/*/nofile
diff --git a/src/testdir/test_alot.vim b/src/testdir/test_alot.vim
index 3cd1f82..e89afb4 100644
--- a/src/testdir/test_alot.vim
+++ b/src/testdir/test_alot.vim
@@ -4,6 +4,7 @@
 source test_backspace_opt.vim
 source test_cursor_func.vim
 source test_delete.vim
+source test_expand.vim
 source test_lispwords.vim
 source test_menu.vim
 source test_searchpos.vim
diff --git a/src/testdir/test_expand.vim b/src/testdir/test_expand.vim
new file mode 100644
index 0000000..fd999db
--- /dev/null
+++ b/src/testdir/test_expand.vim
@@ -0,0 +1,36 @@
+" Test for expanding file names
+
+func Test_with_directories()
+  call mkdir('Xdir1')
+  call mkdir('Xdir2')
+  call mkdir('Xdir3')
+  cd Xdir3
+  call mkdir('Xdir4')
+  cd ..
+
+  split Xdir1/file
+  call setline(1, ['a', 'b'])
+  w
+  w Xdir3/Xdir4/file
+  close
+
+  next Xdir?/*/file
+  call assert_equal('Xdir3/Xdir4/file', expand('%'))
+  next! Xdir?/*/nofile
+  call assert_equal('Xdir?/*/nofile', expand('%'))
+
+  call delete('Xdir1', 'rf')
+  call delete('Xdir2', 'rf')
+  call delete('Xdir3', 'rf')
+endfunc
+
+func Test_with_tilde()
+  let dir = getcwd()
+  call mkdir('Xdir ~ dir')
+  call assert_true(isdirectory('Xdir ~ dir'))
+  cd Xdir\ ~\ dir
+  call assert_true(getcwd() =~ 'Xdir \~ dir')
+  exe 'cd ' . fnameescape(dir)
+  call delete('Xdir ~ dir', 'd')
+  call assert_false(isdirectory('Xdir ~ dir'))
+endfunc