- num
A unique identifier for a test, helpful in identifying the source of failure when testing is not working. Currently, we use a manually-incremented system with tests formatted as n.m
, where essentially n
indexes an issue and m
indexes aspects of that issue. For the most part, your new PR should only have one value of n
(scroll to the end of inst/tests/tests.Rraw
to see the next available ID) and then index the tests within your PR by increasing m
. Note -- n.m
is interpreted as a number, so 123.4
and 123.40
are actually the same -- please 0
-pad as appropriate. Test identifiers are checked to be in increasing order at runtime to prevent duplicates being possible.
- x
An input expression to be evaluated.
- y
Pre-defined value to compare to x
, by default TRUE
.
- error
When you are testing behaviour of code that you expect to fail with an error, supply the expected error message to this argument. It is interpreted as a regular expression, so you can be abbreviated, but try to include the key portion of the error so as not to accidentally include a different error message.
- warning
Same as error
, in the case that you expect your code to issue a warning. Note that since the code evaluates successfully, you should still supply y
.
- message
Same as warning
but expects message
exception.
- output
If you are testing the printing/console output behaviour; e.g. with verbose=TRUE
or options(datatable.verbose=TRUE)
. Again, regex-compatible and case sensitive.
- notOutput
Or if you are testing that a feature does not print particular console output. Case insensitive (unlike output) so that the test does not incorrectly pass just because the string is not found due to case.
- ignore.warning
A single character string. Any warnings emitted by x
that contain this string are dropped. Remaining warnings are compared to the expected warning
as normal.
- options
A named list of options to set for the duration of the test. Any code evaluated during this call to `test()` (usually, `x`, or maybe `y`) will run with the named options set, and the original options will be restored on return. This is a named list since different options can have different types in general, but in typical usage, only one option is set at a time, in which case a named vector is also accepted.
- env
A named list of environment variables to set for the duration of the test, much like options
. A list entry set to NULL
will unset (i.e., Sys.unsetenv
) the corresponding variable.