Description Usage Arguments Details Examples
Note we could simply write the expression itself and let it error,
but using assert
makes the intention of the code clearer
(like using base::force
).
1 |
expr |
expression. This expression should not error. |
... |
additional arguments to |
For testing the converse, there already is expect_error
.
1 2 3 4 | assert(1 + 1) # This will throw no error.
# stopifnot(is(tryCatch(error = identity, assert(not_existent)), 'error'))
# The above will produce an error. In unit tests, it will be clear this
# means "We expect no error to occur."
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.