Mercurial > vim
comparison src/testdir/test_writefile.vim @ 24669:d7644bffe128 v8.2.2873
patch 8.2.2873: not enough tests for writing buffers
Commit: https://github.com/vim/vim/commit/46aa6f93acb5d932d2893606d980a6b4b8a9594c
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Wed May 19 17:15:04 2021 +0200
patch 8.2.2873: not enough tests for writing buffers
Problem: Not enough tests for writing buffers.
Solution: Add a few more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/8229)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 19 May 2021 17:30:03 +0200 |
parents | d3c4ecf67604 |
children | 5194fba32954 |
comparison
equal
deleted
inserted
replaced
24668:6f26d4555812 | 24669:d7644bffe128 |
---|---|
469 " On MS-Windows, modifying files in a read-only directory is allowed. | 469 " On MS-Windows, modifying files in a read-only directory is allowed. |
470 CheckUnix | 470 CheckUnix |
471 " Root can do it too. | 471 " Root can do it too. |
472 CheckNotRoot | 472 CheckNotRoot |
473 | 473 |
474 call mkdir('Xdir') | 474 call mkdir('Xdir/') |
475 call writefile(['one'], 'Xdir/Xfile1') | 475 call writefile(['one'], 'Xdir/Xfile1') |
476 call setfperm('Xdir', 'r-xr--r--') | 476 call setfperm('Xdir', 'r-xr--r--') |
477 " try to create a new file in the directory | 477 " try to create a new file in the directory |
478 new Xdir/Xfile2 | 478 new Xdir/Xfile2 |
479 call setline(1, 'two') | 479 call setline(1, 'two') |
752 setlocal eol | 752 setlocal eol |
753 w | 753 w |
754 call assert_equal(0z6E6F656F6C0A, readfile('XNoEolSetEol', 'B')) | 754 call assert_equal(0z6E6F656F6C0A, readfile('XNoEolSetEol', 'B')) |
755 | 755 |
756 call delete('XNoEolSetEol') | 756 call delete('XNoEolSetEol') |
757 set ff& | 757 set ff& fixeol& |
758 bwipe! XNoEolSetEol | 758 bwipe! XNoEolSetEol |
759 endfunc | 759 endfunc |
760 | 760 |
761 " Test for the 'backupcopy' option when writing files | 761 " Test for the 'backupcopy' option when writing files |
762 func Test_backupcopy() | 762 func Test_backupcopy() |
895 | 895 |
896 call delete('Xfile') | 896 call delete('Xfile') |
897 call delete('Xfile.bak') | 897 call delete('Xfile.bak') |
898 endfunc | 898 endfunc |
899 | 899 |
900 " Test for ':write ++bin' and ':write ++nobin' | |
901 func Test_write_binary_file() | |
902 " create a file without an eol/eof character | |
903 call writefile(0z616161, 'Xfile1', 'b') | |
904 new Xfile1 | |
905 write ++bin Xfile2 | |
906 write ++nobin Xfile3 | |
907 call assert_equal(0z616161, readblob('Xfile2')) | |
908 if has('win32') | |
909 call assert_equal(0z6161610D.0A, readblob('Xfile3')) | |
910 else | |
911 call assert_equal(0z6161610A, readblob('Xfile3')) | |
912 endif | |
913 call delete('Xfile1') | |
914 call delete('Xfile2') | |
915 call delete('Xfile3') | |
916 endfunc | |
917 | |
900 " vim: shiftwidth=2 sts=2 expandtab | 918 " vim: shiftwidth=2 sts=2 expandtab |