| summary.tinytests | R Documentation |
An object of class tinytests (note: plural) results
from running multiple tests from script. E.g. by running
run_test_file.
## S3 method for class 'tinytests'
summary(object, ...)
all_pass(x)
any_pass(x)
all_fail(x)
any_fail(x)
## S3 method for class 'tinytests'
x[i]
## S3 method for class 'tinytests'
print(
x,
passes = getOption("tt.pr.passes", FALSE),
sidefx = getOption("tt.pr.sidefx", TRUE),
limit = getOption("tt.pr.limit", 7),
nlong = getOption("tt.pr.nlong", 3),
...
)
## S3 method for class 'tinytests'
as.data.frame(x, ...)
object |
a |
... |
passed to |
x |
a |
i |
an index |
passes |
|
sidefx |
|
limit |
|
nlong |
|
For summary a table object
For all_pass, any_pass, all_fail, any_fail:
a single logical
For `[.tinytests` a tinytests object.
For as.data.frame. a data frame.
By default, the first 3 failing test results are printed in long form,
the next 7 failing test results are printed in short form and all other
failing tests are not printed. These defaults can be changed by passing options
to print.tinytest, or by setting one or more of the following global
options:
tt.pr.passes Set to TRUE to print output of non-failing tests.
tt.pr.limit Max number of results to print (e.g. Inf)
tt.pr.nlong The number of results to print in long format (e.g. Inf).
For example, set options(tt.pr.limit=Inf) to print all test results.
Furthermore, there is the option
tt.pr.color,
which determines whether colored output is printed.
If R is running in a dumb terminal (detected by comparing
environment variable "TERM" to "dumb"), then
this option is set to FALSE when the package is loaded.
Other test-files:
build_install_test(),
exit_file(),
run_test_dir(),
run_test_file(),
test_package()
# create a test file in tempdir tests <- " addOne <- function(x) x + 2 expect_true(addOne(0) > 0) expect_equal(2, addOne(1)) " testfile <- tempfile(pattern="test_", fileext=".R") write(tests, testfile) # extract testdir testdir <- dirname(testfile) # run all files starting with 'test' in testdir out <- run_test_dir(testdir) # # print results print(out) summary(out) dat <- as.data.frame(out) out[1]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.