Mercurial > vim
comparison src/testdir/test_writefile.vim @ 30150:0fe61fa4e5d1 v9.0.0411
patch 9.0.0411: only created files can be cleaned up with one call
Commit: https://github.com/vim/vim/commit/6f14da15ac900589f2f413d77898b9bff3b31ece
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Sep 7 21:30:44 2022 +0100
patch 9.0.0411: only created files can be cleaned up with one call
Problem: Only created files can be cleaned up with one call.
Solution: Add flags to mkdir() to delete with a deferred function.
Expand the writefile() name to a full path to handle changing
directory.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 07 Sep 2022 22:45:04 +0200 |
parents | bd62c3173f72 |
children | ea2935ec4435 |
comparison
equal
deleted
inserted
replaced
30149:58dd17222e56 | 30150:0fe61fa4e5d1 |
---|---|
948 call assert_equal('', glob('XdeferDelete')) | 948 call assert_equal('', glob('XdeferDelete')) |
949 call DefWriteDefer() | 949 call DefWriteDefer() |
950 call assert_equal('', glob('XdefdeferDelete')) | 950 call assert_equal('', glob('XdefdeferDelete')) |
951 endfunc | 951 endfunc |
952 | 952 |
953 func DoWriteFile() | |
954 call writefile(['text'], 'Xthefile', 'D') | |
955 cd .. | |
956 endfunc | |
957 | |
958 func Test_write_defer_delete_chdir() | |
959 let dir = getcwd() | |
960 call DoWriteFile() | |
961 call assert_notequal(dir, getcwd()) | |
962 call chdir(dir) | |
963 call assert_equal('', glob('Xthefile')) | |
964 endfunc | |
965 | |
953 " Check that buffer is written before triggering QuitPre | 966 " Check that buffer is written before triggering QuitPre |
954 func Test_wq_quitpre_autocommand() | 967 func Test_wq_quitpre_autocommand() |
955 edit Xsomefile | 968 edit Xsomefile |
956 call setline(1, 'hello') | 969 call setline(1, 'hello') |
957 split | 970 split |