15c71994fSBram Moolenaar" Test 'autochdir' behavior
25c71994fSBram Moolenaar
38c5a278fSBram Moolenaarsource check.vim
48c5a278fSBram MoolenaarCheckOption autochdir
55c71994fSBram Moolenaar
65c71994fSBram Moolenaarfunc Test_set_filename()
7cf1ba35fSBram Moolenaar  let cwd = getcwd()
85c71994fSBram Moolenaar  call test_autochdir()
95c71994fSBram Moolenaar  set acd
102caad3fbSBram Moolenaar
112caad3fbSBram Moolenaar  let s:li = []
122caad3fbSBram Moolenaar  autocmd DirChanged auto call add(s:li, "autocd")
132caad3fbSBram Moolenaar  autocmd DirChanged auto call add(s:li, expand("<afile>"))
142caad3fbSBram Moolenaar
155c71994fSBram Moolenaar  new
165c71994fSBram Moolenaar  w samples/Xtest
175c71994fSBram Moolenaar  call assert_equal("Xtest", expand('%'))
185c71994fSBram Moolenaar  call assert_equal("samples", substitute(getcwd(), '.*/\(\k*\)', '\1', ''))
192caad3fbSBram Moolenaar  call assert_equal(["autocd", getcwd()], s:li)
202caad3fbSBram Moolenaar
215c71994fSBram Moolenaar  bwipe!
222caad3fbSBram Moolenaar  au! DirChanged
235c71994fSBram Moolenaar  set noacd
243503d7c9SBram Moolenaar  call chdir(cwd)
255c71994fSBram Moolenaar  call delete('samples/Xtest')
265c71994fSBram Moolenaarendfunc
276d91bcb4SBram Moolenaar
280526815cSBram Moolenaarfunc Test_verbose_pwd()
290526815cSBram Moolenaar  let cwd = getcwd()
300526815cSBram Moolenaar  call test_autochdir()
310526815cSBram Moolenaar
320526815cSBram Moolenaar  edit global.txt
330526815cSBram Moolenaar  call assert_match('\[global\].*testdir$', execute('verbose pwd'))
340526815cSBram Moolenaar
350526815cSBram Moolenaar  call mkdir('Xautodir')
360526815cSBram Moolenaar  split Xautodir/local.txt
370526815cSBram Moolenaar  lcd Xautodir
380526815cSBram Moolenaar  call assert_match('\[window\].*testdir[/\\]Xautodir', execute('verbose pwd'))
390526815cSBram Moolenaar
400526815cSBram Moolenaar  set acd
410526815cSBram Moolenaar  wincmd w
420526815cSBram Moolenaar  call assert_match('\[autochdir\].*testdir$', execute('verbose pwd'))
43*64be6aa3Szeertzjq  execute 'lcd' cwd
44*64be6aa3Szeertzjq  call assert_match('\[window\].*testdir$', execute('verbose pwd'))
45*64be6aa3Szeertzjq  execute 'tcd' cwd
46*64be6aa3Szeertzjq  call assert_match('\[tabpage\].*testdir$', execute('verbose pwd'))
47*64be6aa3Szeertzjq  execute 'cd' cwd
48*64be6aa3Szeertzjq  call assert_match('\[global\].*testdir$', execute('verbose pwd'))
49*64be6aa3Szeertzjq  edit
50*64be6aa3Szeertzjq  call assert_match('\[autochdir\].*testdir$', execute('verbose pwd'))
510526815cSBram Moolenaar  wincmd w
520526815cSBram Moolenaar  call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd'))
530526815cSBram Moolenaar  set noacd
540526815cSBram Moolenaar  call assert_match('\[autochdir\].*testdir[/\\]Xautodir', execute('verbose pwd'))
550526815cSBram Moolenaar  wincmd w
560526815cSBram Moolenaar  call assert_match('\[global\].*testdir', execute('verbose pwd'))
570526815cSBram Moolenaar  wincmd w
580526815cSBram Moolenaar  call assert_match('\[window\].*testdir[/\\]Xautodir', execute('verbose pwd'))
590526815cSBram Moolenaar
600526815cSBram Moolenaar  bwipe!
610526815cSBram Moolenaar  call chdir(cwd)
620526815cSBram Moolenaar  call delete('Xautodir', 'rf')
630526815cSBram Moolenaarendfunc
640526815cSBram Moolenaar
656d91bcb4SBram Moolenaar" vim: shiftwidth=2 sts=2 expandtab
66