view src/testdir/test_autochdir.vim @ 21709:16d6b626aa8f v8.2.1404

patch 8.2.1404: Vim9: script test fails in the GUI Commit: https://github.com/vim/vim/commit/b3ca98240761d8f320c5a49e077d1aac6496bb21 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Aug 9 14:43:58 2020 +0200 patch 8.2.1404: Vim9: script test fails in the GUI Problem: Vim9: script test fails in the GUI. Solution: Use another key to map. Improve cleanup.
author Bram Moolenaar <Bram@vim.org>
date Sun, 09 Aug 2020 14:45:04 +0200
parents 26a04a556982
children 08940efa6b4e
line wrap: on
line source

" Test 'autochdir' behavior

source check.vim
CheckOption autochdir

func Test_set_filename()
  let cwd = getcwd()
  call test_autochdir()
  set acd

  let s:li = []
  autocmd DirChanged auto call add(s:li, "autocd")
  autocmd DirChanged auto call add(s:li, expand("<afile>"))

  new
  w samples/Xtest
  call assert_equal("Xtest", expand('%'))
  call assert_equal("samples", substitute(getcwd(), '.*/\(\k*\)', '\1', ''))
  call assert_equal(["autocd", getcwd()], s:li)

  bwipe!
  au! DirChanged
  set noacd
  call chdir(cwd)
  call delete('samples/Xtest')
endfunc