Mercurial > vim
comparison src/testdir/test_writefile.vim @ 23308:4d6c1b17f66a v8.2.2199
patch 8.2.2199: first write after setting 'eol' does not have NL added
Commit: https://github.com/vim/vim/commit/b3c8b1d25414f2e24ad03551cdf125b3e2c142b1
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Dec 23 18:54:57 2020 +0100
patch 8.2.2199: first write after setting 'eol' does not have NL added
Problem: First write after setting 'eol' does not have NL added. (Tom??
Janou?ek)
Solution: Only use b_no_eol_lnum when doing a binary write. (closes #7535)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 23 Dec 2020 19:00:04 +0100 |
parents | ff21e2962490 |
children | 4841385b981a |
comparison
equal
deleted
inserted
replaced
23307:74c40d38612f | 23308:4d6c1b17f66a |
---|---|
674 call delete('Xfile2') | 674 call delete('Xfile2') |
675 call delete('Xtest3') | 675 call delete('Xtest3') |
676 %bw! | 676 %bw! |
677 endfunc | 677 endfunc |
678 | 678 |
679 func Test_read_write_bin() | |
680 " write file missing EOL | |
681 call writefile(['noeol'], "XNoEolSetEol", 'bS') | |
682 call assert_equal(0z6E6F656F6C, readfile('XNoEolSetEol', 'B')) | |
683 | |
684 " when file is read 'eol' is off | |
685 set ff=unix nofixeol | |
686 e XNoEolSetEol | |
687 call assert_equal(0, &eol) | |
688 | |
689 " writing with 'eol' set adds the newline | |
690 setlocal eol | |
691 w | |
692 call assert_equal(0z6E6F656F6C0A, readfile('XNoEolSetEol', 'B')) | |
693 | |
694 call delete('XNoEolSetEol') | |
695 endfunc | |
696 | |
679 " vim: shiftwidth=2 sts=2 expandtab | 697 " vim: shiftwidth=2 sts=2 expandtab |