Each individual test in the package generates a tinytest object. A tinytest object is a logical scalar, with metadata (attributes) about the test.
tinytest
logical
tinytest( result, call, trace = NULL, diff = NA_character_, short = c(NA_character_, "data", "attr", "xcpt", "envv", "wdir", "file", "lcle"), info = NA_character_, file = NA_character_, fst = NA_integer_, lst = NA_integer_, ... )
A tinytest object.
[logical] scalar.
[logical]
[call] The call that created result.
[call]
result
[character] difference between current and target value (if any).
[character]
[character] short description of the difference
[character] other information, to be printed in the long message
[character] File location of the test.
[integer] First line number in the test file.
[integer]
[integer] Last line number in the test file (differs from fst if the call spans multiple lines).
fst
The result can take three values.
TRUE: test was passed.
TRUE
FALSE: test was failed.
FALSE
NA: A side effect was detected.
NA
Authors of extension packages should not use NA as a result value as this part of the interface may change in the future.
Other extensions: register_tinytest_extension(), using()
register_tinytest_extension()
using()
tt <- expect_equal(1+1, 2) if (isTRUE(tt)){ print("w00p w00p!") } else { print("Oh no!") }
Run the code above in your browser using DataLab