Description Usage Arguments Value Author(s) See Also Examples
Tests Silent Execution of an Function
1 | test_execution(what, args, xmlTestSpec = NULL, ...)
|
what, args |
Parameters for execution of the test function
(see |
xmlTestSpec |
( |
... |
Additional parameters passed to |
ANY
result of test functin
Matthias Pfeifer matthias.pfeifer@roche.com
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 | value <- test_execution(
"sum",
list(x=2,y=3),
xmlTestSpec=XML::xmlNode(
name="execution",
attrs=list('execution-type'="silent"))
)
stopifnot(value==5)
# Create a function that always produces warnings
sum_test <- function(...){
warning("test")
sum(...)
}
# Let this function run and crash, if it crashes check if the error contains "produced warnings"
tryCatch(
test_execution(
"sum_test",
list(x=2,y=3),
xmlTestSpec=XML::xmlNode(name="execution",attrs=list("execution-type"="silent"))
),error=function(e){
stopifnot(grepl("produced warnings",e))
})
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.