1
0
forked from aniani/vim

patch 9.0.0380: deleting files in tests is a hassle

Problem:    Deleting files in tests is a hassle.
Solution:   Use the new 'D' flag of writefile().
This commit is contained in:
Bram Moolenaar
2022-09-04 21:29:08 +01:00
parent 8f7116cadd
commit e1f3ab73bc
4 changed files with 46 additions and 81 deletions

View File

@@ -89,12 +89,12 @@ func Test_assert_equalfile()
call remove(v:errors, 0)
let goodtext = ["one", "two", "three"]
call writefile(goodtext, 'Xone')
call writefile(goodtext, 'Xone', 'D')
call assert_equal(1, 'Xone'->assert_equalfile('xyzxyz'))
call assert_match("E485: Can't read file xyzxyz", v:errors[0])
call remove(v:errors, 0)
call writefile(goodtext, 'Xtwo')
call writefile(goodtext, 'Xtwo', 'D')
call assert_equal(0, assert_equalfile('Xone', 'Xtwo'))
call writefile([goodtext[0]], 'Xone')
@@ -124,9 +124,6 @@ func Test_assert_equalfile()
call assert_equal(1, assert_equalfile('Xone', 'Xtwo', 'a message'))
call assert_match("a message: difference at byte 234, line 1 after", v:errors[0])
call remove(v:errors, 0)
call delete('Xone')
call delete('Xtwo')
endfunc
func Test_assert_notequal()