view src/testdir/test_autochdir.vim @ 19044:af795b6a2624

patch 8.2.0082: when reusing a buffer listeners are not cleared Commit: https://github.com/vim/vim/commit/f10997a1543eb0724d882da3678bacd44e647141 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 3 21:00:02 2020 +0100 patch 8.2.0082: when reusing a buffer listeners are not cleared Problem: When reusing a buffer listeners are not cleared. (Axel Forsman) Solution: Clear listeners when reusing a buffer. (closes https://github.com/vim/vim/issues/5431)
author Bram Moolenaar <Bram@vim.org>
date Fri, 03 Jan 2020 21:00:16 +0100
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