1" Tests for complicated + argument to :edit command 2function Test_edit() 3 call writefile(["foo|bar"], "Xfile1") 4 call writefile(["foo/bar"], "Xfile2") 5 edit +1|s/|/PIPE/|w Xfile1| e Xfile2|1 | s/\//SLASH/|w 6 call assert_equal(["fooPIPEbar"], readfile("Xfile1")) 7 call assert_equal(["fooSLASHbar"], readfile("Xfile2")) 8 call delete('Xfile1') 9 call delete('Xfile2') 10endfunction 11 12func Test_edit_bad() 13 " Test loading a utf8 file with bad utf8 sequences. 14 call writefile(["[\xff][\xc0][\xe2\x89\xf0][\xc2\xc2]"], "Xfile") 15 new 16 17 " Without ++bad=..., the default behavior is like ++bad=? 18 e! ++enc=utf8 Xfile 19 call assert_equal('[?][?][???][??]', getline(1)) 20 21 e! ++enc=utf8 ++bad=_ Xfile 22 call assert_equal('[_][_][___][__]', getline(1)) 23 24 e! ++enc=utf8 ++bad=drop Xfile 25 call assert_equal('[][][][]', getline(1)) 26 27 e! ++enc=utf8 ++bad=keep Xfile 28 call assert_equal("[\xff][\xc0][\xe2\x89\xf0][\xc2\xc2]", getline(1)) 29 30 call assert_fails('e! ++enc=utf8 ++bad=foo Xfile', 'E474:') 31 32 bw! 33 call delete('Xfile') 34endfunc 35