aboutsummaryrefslogtreecommitdiff
path: root/test/old/testdir/test_writefile.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-16 15:59:32 +0800
committerGitHub <noreply@github.com>2023-04-16 15:59:32 +0800
commit0d9b0fbe579343fa6d6c46e6e1bf6bb8719ea5e0 (patch)
treeb04989c130e1139760f6ccc19236ccf55fc24afa /test/old/testdir/test_writefile.vim
parent54dab9ed9e200f7c5bcac4a8f4901770fa15fa4f (diff)
parent8a59d04a31725d9038e8c7df30f9b95ea82f9a76 (diff)
downloadrneovim-0d9b0fbe579343fa6d6c46e6e1bf6bb8719ea5e0.tar.gz
rneovim-0d9b0fbe579343fa6d6c46e6e1bf6bb8719ea5e0.tar.bz2
rneovim-0d9b0fbe579343fa6d6c46e6e1bf6bb8719ea5e0.zip
Merge pull request #23119 from zeertzjq/vim-9.0.0370
vim-patch:9.0.{0370,0379,0390,0397,0411,1446}: :defer and deferred delete
Diffstat (limited to 'test/old/testdir/test_writefile.vim')
-rw-r--r--test/old/testdir/test_writefile.vim50
1 files changed, 40 insertions, 10 deletions
diff --git a/test/old/testdir/test_writefile.vim b/test/old/testdir/test_writefile.vim
index 6019cee193..312d45e18f 100644
--- a/test/old/testdir/test_writefile.vim
+++ b/test/old/testdir/test_writefile.vim
@@ -924,19 +924,49 @@ endfunc
" Test for ':write ++bin' and ':write ++nobin'
func Test_write_binary_file()
" create a file without an eol/eof character
- call writefile(0z616161, 'Xfile1', 'b')
- new Xfile1
- write ++bin Xfile2
- write ++nobin Xfile3
- call assert_equal(0z616161, readblob('Xfile2'))
+ call writefile(0z616161, 'Xwbfile1', 'b')
+ new Xwbfile1
+ write ++bin Xwbfile2
+ write ++nobin Xwbfile3
+ call assert_equal(0z616161, readblob('Xwbfile2'))
if has('win32')
- call assert_equal(0z6161610D.0A, readblob('Xfile3'))
+ call assert_equal(0z6161610D.0A, readblob('Xwbfile3'))
else
- call assert_equal(0z6161610A, readblob('Xfile3'))
+ call assert_equal(0z6161610A, readblob('Xwbfile3'))
endif
- call delete('Xfile1')
- call delete('Xfile2')
- call delete('Xfile3')
+ call delete('Xwbfile1')
+ call delete('Xwbfile2')
+ call delete('Xwbfile3')
+endfunc
+
+func DoWriteDefer()
+ call writefile(['some text'], 'XdeferDelete', 'D')
+ call assert_equal(['some text'], readfile('XdeferDelete'))
+endfunc
+
+" def DefWriteDefer()
+" writefile(['some text'], 'XdefdeferDelete', 'D')
+" assert_equal(['some text'], readfile('XdefdeferDelete'))
+" enddef
+
+func Test_write_with_deferred_delete()
+ call DoWriteDefer()
+ call assert_equal('', glob('XdeferDelete'))
+ " call DefWriteDefer()
+ " call assert_equal('', glob('XdefdeferDelete'))
+endfunc
+
+func DoWriteFile()
+ call writefile(['text'], 'Xthefile', 'D')
+ cd ..
+endfunc
+
+func Test_write_defer_delete_chdir()
+ let dir = getcwd()
+ call DoWriteFile()
+ call assert_notequal(dir, getcwd())
+ call chdir(dir)
+ call assert_equal('', glob('Xthefile'))
endfunc
" Check that buffer is written before triggering QuitPre