https://github.com/cran/pkgdown
Raw File
Tip revision: be39bf7826519337f2174410168506d8cd3cbe75 authored by Hadley Wickham on 30 November 2021, 20:10:03 UTC
version 2.0.0
Tip revision: be39bf7
test-dont.Rd
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/test.R
\name{test-dont}
\alias{test-dont}
\title{Test case: don't}
\description{
Test case: don't
}
\examples{
\dontrun{
  stop("This is an error!", call. = FALSE)
}

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

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

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

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

# To hide the \dontshow part, for conditional examples
\dontshow{if (FALSE) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
answer <- 43
\dontshow{\}) # examplesIf}
answer # should be still 42

# But this one runs, and the condition is hidden
\dontshow{if (TRUE) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
answer <- 43
\dontshow{\}) # examplesIf}
answer
}
\seealso{
Other tests: 
\code{\link{index}},
\code{\link{test-crayon}},
\code{\link{test-figures}},
\code{\link{test-links}},
\code{\link{test-lists}},
\code{\link{test-long-lines}},
\code{\link{test-output-styles}},
\code{\link{test-params}},
\code{\link{test-sexpr-title}},
\code{\link{test-verbatim}}
}
\concept{tests}
\keyword{internal}
back to top