Test case: don't

Examples

if (FALSE) {
  stop("This is an error!", call. = FALSE)
}

# Inline \donttest is silently ommitted
message("Hi!")
#> Hi!

# Block \donttest indicated with comments
# \donttest{
# This is a comment
1 + 3
#> [1] 4
# }

# And works even when not at the top level
if (TRUE) {
  # \donttest{
  1 + 2
  # }
}
#> [1] 3

answer <- 1
# \dontshow{
answer <- 42
# }
answer # should be 42
#> [1] 42

# To hide the \dontshow part, for conditional examples
if (FALSE) {
answer <- 43
}
answer # should be still 42
#> [1] 42

# But this one runs, and the condition is hidden
answer <- 43
answer
#> [1] 43