Mercurial > vim
view src/testdir/test_writefile.vim @ 12090:c4caf49c8bf4 v8.0.0925
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
commit https://github.com/vim/vim/commit/62426e168ef29fb941d1bd91a112fa09445322a5
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Aug 13 15:37:58 2017 +0200
patch 8.0.0925: MS-Windows GUI: channel I/O not handled right away
Problem: MS-Windows GUI: channel I/O not handled right away.
Solution: Don't call process_message() unless a message is available.
(Yasuhiro Matsumoto, closes #1969)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 13 Aug 2017 15:45:04 +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