Test case: don't
See also
Other tests:
index
,
test-crayon
,
test-figures
,
test-links
,
test-lists
,
test-long-lines
,
test-output-styles
,
test-params
,
test-sexpr-title
,
test-tables
,
test-verbatim
Examples
# \dontrun{} --------------------------------------------------------
# always shown; never run
x <- 1
if (FALSE) x <- 2 # \dontrun{}
if (FALSE) { # \dontrun{
x <- 3
x <- 4
} # }
x # should be 1
#> [1] 1
# \donttest{} -------------------------------------------------------
# only multiline are shown; always run
x <- 1
x <- 2
# \donttest{
x <- 3
x <- 4
# }
x # should be 4
#> [1] 4
# \testonly{} -----------------------------------------------------
# never shown, never run
x <- 1
x # should be 1
#> [1] 1
# \dontshow{} -------------------------------------------------------
# never shown, always run
x <- 1
x # should be 4
#> [1] 4
# @examplesIf ------------------------------------------------------
# If FALSE, wrapped in if; if TRUE, not seen
x <- 1
if (FALSE) {
x <- 2
}
x <- 3
x # should be 3
#> [1] 3