comparison src/testdir/test_plus_arg_edit.vim @ 30592:457ea0570b6f v9.0.0631

patch 9.0.0631: too many delete() calls in tests Commit: https://github.com/vim/vim/commit/145d1fd91041bd2a22a11eef0357702e420796e2 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Sep 30 21:57:11 2022 +0100 patch 9.0.0631: too many delete() calls in tests Problem: Too many delete() calls in tests. Solution: Use deferred delete where possible.
author Bram Moolenaar <Bram@vim.org>
date Fri, 30 Sep 2022 23:00:10 +0200
parents 13b02c1ea0f7
children
comparison
equal deleted inserted replaced
30591:38ef10db4a4e 30592:457ea0570b6f
1 " Tests for complicated + argument to :edit command 1 " Tests for complicated + argument to :edit command
2 2
3 function Test_edit() 3 function Test_edit()
4 call writefile(["foo|bar"], "Xfile1") 4 call writefile(["foo|bar"], "Xfile1", 'D')
5 call writefile(["foo/bar"], "Xfile2") 5 call writefile(["foo/bar"], "Xfile2", 'D')
6 edit +1|s/|/PIPE/|w Xfile1| e Xfile2|1 | s/\//SLASH/|w 6 edit +1|s/|/PIPE/|w Xfile1| e Xfile2|1 | s/\//SLASH/|w
7 call assert_equal(["fooPIPEbar"], readfile("Xfile1")) 7 call assert_equal(["fooPIPEbar"], readfile("Xfile1"))
8 call assert_equal(["fooSLASHbar"], readfile("Xfile2")) 8 call assert_equal(["fooSLASHbar"], readfile("Xfile2"))
9 call delete('Xfile1')
10 call delete('Xfile2')
11 endfunction 9 endfunction
12 10
13 func Test_edit_bad() 11 func Test_edit_bad()
14 " Test loading a utf8 file with bad utf8 sequences. 12 " Test loading a utf8 file with bad utf8 sequences.
15 call writefile(["[\xff][\xc0][\xe2\x89\xf0][\xc2\xc2]"], "Xbadfile") 13 call writefile(["[\xff][\xc0][\xe2\x89\xf0][\xc2\xc2]"], "Xbadfile", 'D')
16 new 14 new
17 15
18 " Without ++bad=..., the default behavior is like ++bad=? 16 " Without ++bad=..., the default behavior is like ++bad=?
19 e! ++enc=utf8 Xbadfile 17 e! ++enc=utf8 Xbadfile
20 call assert_equal('[?][?][???][??]', getline(1)) 18 call assert_equal('[?][?][???][??]', getline(1))
29 call assert_equal("[\xff][\xc0][\xe2\x89\xf0][\xc2\xc2]", getline(1)) 27 call assert_equal("[\xff][\xc0][\xe2\x89\xf0][\xc2\xc2]", getline(1))
30 28
31 call assert_fails('e! ++enc=utf8 ++bad=foo Xbadfile', 'E474:') 29 call assert_fails('e! ++enc=utf8 ++bad=foo Xbadfile', 'E474:')
32 30
33 bw! 31 bw!
34 call delete('Xbadfile')
35 endfunc 32 endfunc
36 33
37 " Test for ++bin and ++nobin arguments 34 " Test for ++bin and ++nobin arguments
38 func Test_binary_arg() 35 func Test_binary_arg()
39 new 36 new