comparison src/testdir/test_cd.vim @ 20848:d3fa0d29fa9a v8.2.0976

patch 8.2.0976: some 'cpoptions' not tested Commit: https://github.com/vim/vim/commit/df7df59d85e7e56a796912dc865488a75d3f0e53 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 14 13:50:55 2020 +0200 patch 8.2.0976: some 'cpoptions' not tested Problem: Some 'cpoptions' not tested. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/6253)
author Bram Moolenaar <Bram@vim.org>
date Sun, 14 Jun 2020 14:00:03 +0200
parents d91b8d1e5198
children 6a4806e326dd
comparison
equal deleted inserted replaced
20847:4e1017c5fbb5 20848:d3fa0d29fa9a
54 if RunVim([], [], '--clean -S Xscript') 54 if RunVim([], [], '--clean -S Xscript')
55 call assert_equal([], readfile('Xresult')) 55 call assert_equal([], readfile('Xresult'))
56 endif 56 endif
57 call delete('Xscript') 57 call delete('Xscript')
58 call delete('Xresult') 58 call delete('Xresult')
59 endfunc
60
61 func Test_cd_with_cpo_chdir()
62 e Xfoo
63 call setline(1, 'foo')
64 let path = getcwd()
65 set cpo+=.
66
67 " :cd should fail when buffer is modified and 'cpo' contains dot.
68 call assert_fails('cd ..', 'E747:')
69 call assert_equal(path, getcwd())
70
71 " :cd with exclamation mark should succeed.
72 cd! ..
73 call assert_notequal(path, getcwd())
74
75 " :cd should succeed when buffer has been written.
76 w!
77 exe 'cd ' .. fnameescape(path)
78 call assert_equal(path, getcwd())
79
80 call delete('Xfoo')
81 set cpo&
82 bw!
83 endfunc 59 endfunc
84 60
85 " Test for chdir() 61 " Test for chdir()
86 func Test_chdir_func() 62 func Test_chdir_func()
87 let topdir = getcwd() 63 let topdir = getcwd()