view src/testdir/test_autochdir.vim @ 17534:2b4c138bf8e9 v8.1.1765

patch 8.1.1765: get(func, dict, def) does not work properly commit https://github.com/vim/vim/commit/f91aac5e3e3b8b1633d84eac2687ebbd76d8133b Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jul 28 13:21:01 2019 +0200 patch 8.1.1765: get(func, dict, def) does not work properly Problem: get(func, dict, def) does not work properly. Solution: Handle NULL dict better. (Takuya Fujiwara, closes https://github.com/vim/vim/issues/4734)
author Bram Moolenaar <Bram@vim.org>
date Sun, 28 Jul 2019 13:30:07 +0200
parents ebdf6cd89910
children 0da9bc55c31a
line wrap: on
line source

" Test 'autochdir' behavior

if !exists("+autochdir")
  throw 'Skipped: autochdir feature missing'
endif

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
  exe 'cd ' . cwd
  call delete('samples/Xtest')
endfunc