summary.tinytests {tinytest}R Documentation

Tinytests object

Description

An object of class tinytests (note: plural) results from running multiple tests from script. E.g. by running run_test_file.

Usage

## S3 method for class 'tinytests'
summary(object, ...)

## S3 method for class 'tinytests'
x[i]

## S3 method for class 'tinytests'
print(x, passes = getOption("tt.pr.passes", FALSE),
  limit = getOption("tt.pr.limit", 7), nlong = getOption("tt.pr.nlong",
  3), ...)

## S3 method for class 'tinytests'
as.data.frame(x, ...)

Arguments

object

a tinytests object

...

passed to format.tinytest

x

a tinytests object

i

an index

passes

[logical] Toggle: print passing tests?

limit

[numeric] Max number of results to print

nlong

[numeric] First nlong results are printed in long format.

Value

For summary a table object

For [.tinytests another, smaller tinytests object.

For as.data.frame. a data frame.

Details

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 general options:

For example, set options(tt.pr.limit=Inf) to print all test results.

See Also

Other test-files: build_install_test, run_test_dir, run_test_file, test_package

Examples

# 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]


[Package tinytest version 0.9.4 Index]