2017-12-12 13:24 GMT+01:00 Thierry Onkelinx <thierry.onkel...@inbo.be>: > Dear all, > > Some function I wrote deletes a bunch of files. It is crucial that all > files get deleted. Hence it should return an error when one or more > files couldn't be deleted. > > I'm writing a unit test for this function. I fail to create a file > that can't be deleted by the function. I've tried Sys.chmod(file, > "000") which didn't work. > > Any suggestions?
Supposing you call file.remove at some point, what about the following: file.remove <- function(...) { invisible() } # test your function here, should issue an error rm("file.remove") Iñaki ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel