Mercurial > vim
view src/testdir/test_writefile.vim @ 11543:57c452316da1 v8.0.0654
patch 8.0.0654: no warning for text after :endfunction
commit https://github.com/vim/vim/commit/663bb2331626944cea156374858131fcd323b9e9
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jun 22 19:12:10 2017 +0200
patch 8.0.0654: no warning for text after :endfunction
Problem: Text found after :endfunction is silently ignored.
Solution: Give a warning if 'verbose' is set. When | or \n are used,
execute the text as a command.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 22 Jun 2017 19:15:04 +0200 |
parents | 4a1f7849fe86 |
children | 16ccaedce025 |
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