Mercurial > vim
view src/testdir/test_writefile.vim @ 11698:4f59d2a66bf7 v8.0.0732
patch 8.0.0732: when updating a buffer modeless selection is lost
commit https://github.com/vim/vim/commit/80dd3f9d41ce2ff6ab3544cdb266627bbdfc34a6
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jul 19 12:51:52 2017 +0200
patch 8.0.0732: when updating a buffer modeless selection is lost
Problem: When updating a buffer for a callback the modeless selection is
lost.
Solution: Do not insert or delete screen lines when redrawing for a callback
and there is a modeless selection.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 19 Jul 2017 13:00:03 +0200 |
parents | 16ccaedce025 |
children | ae2802b6bf7d |
line wrap: on
line source
" Tests for the writefile() function. func Test_writefile() let f = tempname() call writefile(["over","written"], f, "b") call writefile(["hello","world"], f, "b") call writefile(["!", "good"], f, "a") call writefile(["morning"], f, "ab") call writefile(["", "vimmers"], f, "ab") let l = readfile(f) call assert_equal("hello", l[0]) call assert_equal("world!", l[1]) call assert_equal("good", l[2]) call assert_equal("morning", l[3]) call assert_equal("vimmers", l[4]) call delete(f) endfunc func Test_writefile_fails_gently() call assert_fails('call writefile(["test"], "Xfile", [])', 'E730:') call assert_false(filereadable("Xfile")) call delete("Xfile") call assert_fails('call writefile(["test", [], [], [], "tset"], "Xfile")', 'E730:') call assert_false(filereadable("Xfile")) call delete("Xfile") call assert_fails('call writefile([], "Xfile", [])', 'E730:') call assert_false(filereadable("Xfile")) call delete("Xfile") call assert_fails('call writefile([], [])', 'E730:') endfunc func Test_writefile_fails_conversion() if !has('multi_byte') || !has('iconv') return endif set nobackup nowritebackup new let contents = ["line one", "line two"] call writefile(contents, 'Xfile') edit Xfile call setline(1, ["first line", "cannot convert \u010b", "third line"]) call assert_fails('write ++enc=cp932') call assert_equal(contents, readfile('Xfile')) call delete('Xfile') bwipe! set backup& writebackup& endfunc