/usr/lib/R/site-library/ShortRead/unitTests/test_SRError.R is in r-bioc-shortread 1.36.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | throw <- ShortRead:::.throw
## SRError
test_SRError_construction <- function() {
checkTrue(validObject(SRError("UnspecifiedError", "message")))
checkException(SRError(), silent=TRUE)
checkException(SBError("UnspecifiedError"),
silent=TRUE) # must have message
checkException(SRError("Bad error class", "Message"),
silent=TRUE) # must have valid class
}
test_SRError_throw <- function() {
err <- SRError("UnspecifiedError", "error message")
checkException(throw(err), silent=TRUE)
}
test_SRError_throw <- function() {
err <- SRError("UnspecifiedError", "error message")
checkTrue(tryCatch(throw(err),
SRError=function(err) TRUE))
checkTrue(tryCatch(throw(err),
UnspecifiedError=function(err) TRUE))
}
## SRWarn
test_SRWarn_construction <- function() {
checkTrue(validObject(SRWarn("UnspecifiedWarning", "message")))
checkException(SRWarn(), silent=TRUE)
checkException(SRWarn("UnspecifiedWarning"), silent=TRUE)
checkException(SRWarn("Bad Warn Class"), silent=TRUE)
}
test_SRWarn_throw <- function() {
old.opt <- options(warn=2)
on.exit(options(old.opt))
warn <- SRWarn("UnspecifiedWarning", "warning message")
checkException(throw(warn), silent=TRUE)
}
test_SRWarn_catch <- function() {
old.opt <- options(warn=2)
on.exit(options(old.opt))
warn <- SRWarn("UnspecifiedWarning", "warning message")
checkTrue(tryCatch(throw(warn),
SRWarn=function(warn) TRUE))
checkTrue(tryCatch(throw(warn),
UnspecifiedWarning=function(warn) TRUE))
}
|