Skip to content

Support nested \donttest \dontrun #498

@lorenzwalthert

Description

@lorenzwalthert
style_text("
#' Remove the local CITES database
#'
#' @examples
#' \\donttest{
#' \\dontrun{
#' cites_db_delete()
#' }
#' }
cites_db_delete <- function() {
  for (t in dbListTables(cites_db())) {
    dbRemoveTable(cites_db(), t)
  }
  update_cites_pane()
}"
)
#> Error in if (from > to) {: missing value where TRUE/FALSE needed

Created on 2019-04-26 by the reprex package (v0.2.1)

Taken from ropensci-archive/citesdb#3. Also note that these don't need to be completely nested to pass R CMD check:

#' test
#' @examples
#' \dontrun{\donttest{
#' 2
#' }
#' 1
#' }
test <- function()
  NULL

Approaches (simple to hard):

  • catch error in roxygen and still style rest of input file.
  • Fail more informatively on whole file.
  • support nested but only where all R expressions are in most inner loop.
  • support general case where donts and r expressions can occur anywhere.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions