Skip to contents

Test case: don't

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