|
6 | 6 | #' making it possible to run all examples from an R function. |
7 | 7 | #' |
8 | 8 | #' @template devtools |
| 9 | +#' @inheritParams pkgload::run_example |
9 | 10 | #' @param start Where to start running the examples: this can either be the |
10 | 11 | #' name of `Rd` file to start with (with or without extensions), or |
11 | 12 | #' a topic name. If omitted, will start with the (lexicographically) first |
12 | 13 | #' file. This is useful if you have a lot of examples and don't want to |
13 | 14 | #' rerun them every time you fix a problem. |
14 | 15 | #' @family example functions |
15 | 16 | #' @param show DEPRECATED. |
16 | | -#' @param test if `TRUE`, code in \code{\\donttest{}} will be commented |
17 | | -#' out. If `FALSE`, code in \code{\\testonly{}} will be commented out. |
18 | | -#' @param run if `FALSE`, code in \code{\\dontrun{}} will be commented |
19 | | -#' out. |
20 | 17 | #' @param fresh if `TRUE`, will be run in a fresh R session. This has |
21 | 18 | #' the advantage that there's no way the examples can depend on anything in |
22 | 19 | #' the current session, but interactive code (like [browser()]) |
|
25 | 22 | #' examples are updated before running them. |
26 | 23 | #' @keywords programming |
27 | 24 | #' @export |
28 | | -run_examples <- function(pkg = ".", start = NULL, show = TRUE, test = FALSE, |
29 | | - run = FALSE, fresh = FALSE, document = TRUE) { |
| 25 | +run_examples <- function(pkg = ".", start = NULL, show = TRUE, run_donttest = FALSE, |
| 26 | + run_dontrun = FALSE, fresh = FALSE, document = TRUE, run, test) { |
| 27 | + |
| 28 | + if (!missing(run)) { |
| 29 | + warning("`run_examples(run=)` is deprecated, please use `run_example(run_dontrun=)` instead", call. = FALSE) |
| 30 | + run_dontrun <- run |
| 31 | + } |
| 32 | + if (!missing(test)) { |
| 33 | + warning("`run_examples(test=)` is deprecated, please use `run_example(run_donttest=)` instead", call. = FALSE) |
| 34 | + run_donttest <- test |
| 35 | + } |
| 36 | + |
30 | 37 | pkg <- as.package(pkg) |
31 | 38 |
|
32 | 39 | if (fresh) { |
@@ -60,7 +67,7 @@ run_examples <- function(pkg = ".", start = NULL, show = TRUE, test = FALSE, |
60 | 67 | load_all(pkg$path, reset = TRUE, export_all = FALSE) |
61 | 68 | on.exit(load_all(pkg$path, reset = TRUE)) |
62 | 69 |
|
63 | | - lapply(files, pkgload::run_example, test = test, run = run) |
| 70 | + lapply(files, pkgload::run_example, run_donttest = run_donttest, run_dontrun = run_dontrun) |
64 | 71 |
|
65 | 72 | invisible() |
66 | 73 | } |
|
0 commit comments