diff --git a/DESCRIPTION b/DESCRIPTION index 2a642206..771f4edc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: autotest Title: Automatic Package Testing -Version: 0.0.2.204 +Version: 0.0.2.206 Authors@R: c( person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-2172-5265")), @@ -24,6 +24,7 @@ Imports: rlang, testthat, tibble, + typetracer, withr, yaml Suggests: @@ -38,8 +39,10 @@ Suggests: usethis VignetteBuilder: knitr +Remotes: + mpadge/typetracer Encoding: UTF-8 Language: en-GB LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.1 +RoxygenNote: 7.2.1 diff --git a/NAMESPACE b/NAMESPACE index 982e0211..c89ce526 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -5,7 +5,6 @@ export(at_yaml_template) export(autotest_obj) export(autotest_package) export(autotest_types) -export(autotest_yaml) export(examples_to_yaml) export(expect_autotest_no_err) export(expect_autotest_no_testdata) diff --git a/R/autotest-functions.R b/R/autotest-functions.R index fcd68b88..c5230676 100644 --- a/R/autotest-functions.R +++ b/R/autotest-functions.R @@ -1,177 +1,8 @@ -#' autotest_yaml -#' -#' Automatically test inputs to functions specified in a 'yaml' template. -#' -#' @param yaml A 'yaml' template as a character vector, either hand-coded or -#' potentially loaded via \link{readLines} function or similar. Should generally -#' be left at default of 'NULL', with template specified by 'filename' -#' parameter. -#' @param filename Name (potentially including path) of file containing 'yaml' -#' template. See \link{at_yaml_template} for details of template. Default uses -#' template generated by that function, and held in local './tests' directory. -#' @param test If `FALSE`, return only descriptions of tests which would be run -#' with `test = TRUE`, without actually running them. -#' @param test_data Result returned from calling either \link{autotest_types} or -#' \link{autotest_package} with `test = FALSE` that contains a list of all tests -#' which would be conducted. These tests have an additional flag, `test`, which -#' defaults to `TRUE`. Setting any tests to `FALSE` will avoid running them when -#' `test = TRUE`. -#' @param quiet If 'FALSE', provide printed output on screen. -#' @return An `autotest_pkg` object, derived from a \pkg{tibble}, detailing -#' instances of unexpected behaviour for every parameter of every function. -#' @family yaml -#' -#' @examples -#' \dontrun{ -#' yaml_list <- examples_to_yaml (package = "stats", functions = "reshape") -#' res <- autotest_yaml (yaml = yaml_list) -#' } -#' @export -autotest_yaml <- function (yaml = NULL, - filename = NULL, - test = TRUE, - test_data = NULL, - quiet = FALSE) { - - if (is.null (yaml) & is.null (filename)) { - stop ("either yaml or filename must be given") - } else if (!is.null (filename)) { - yaml <- readLines (filename) - pkg <- strsplit (yaml [grep ("^package:", yaml)], - "^package: ") [[1]] [2] - attr (yaml, "package") <- pkg - } - - if (is.character (yaml) & !is.null (attr (yaml, "package"))) { - yaml <- list (yaml) - } - - msg <- paste0 ("yaml must be either a single character vector ", - "representing a yaml 'autotest' object, or a list ", - "of such objects") - if (!is.list (yaml)) - stop (msg) - - # Ensure anything passed as list represents valid yaml input: - if (!is.character (yaml [[1]]) & !is.null (attr (yaml [[1]], "package"))) - stop (msg) - - reports <- lapply (yaml, function (i) - autotest_single_yaml (i, - filename, - test, - test_data, - quiet)) - reports <- do.call (rbind, reports) - - if (!is.null (reports)) { - reports <- tibble::tibble (reports) - class (reports) <- c ("autotest_package", class (reports)) - } - - return (reports) -} - -#' Test one 'yaml' input file -#' -#' @inheritParams autotest_yaml -#' @noRd -autotest_single_yaml <- function (yaml = NULL, - filename = NULL, - test = TRUE, - test_data = NULL, - quiet = FALSE) { - - # yaml templates can be preprocessing only, with no direct function calls: - if (!any (grepl ("- parameters:$", yaml))) - return (NULL) - - res <- parse_yaml_template (yaml = yaml, filename = filename) - - # are parameters exclusively used as single-valued, or vectors? - par_lengths <- single_or_vec (res) - # are numeric parameters exclusively used as integers? - int_val <- double_or_int (res) - - reports <- NULL - - for (i in seq_along (res$parameters)) { - - this_fn <- names (res$parameters) [i] - params <- get_params (res, i, this_fn) - params <- params [which (!(params == "NULL" | names (params) == "..."))] - param_types <- get_param_types (this_fn, params, - par_lengths) - - param_class <- vapply (params, - function (i) - ifelse (inherits (i, "data.frame"), - "data.frame", - class (i) [1]), - character (1)) - index <- which (!param_class %in% c (atomic_modes (), - "data.frame")) - param_class <- param_class [index] - if (length (param_class) == 0L) - param_class <- NULL - - test_obj <- autotest_obj (package = res$package, - package_loc = attr (yaml, "package"), - fn_name = names (res$parameters) [i], - parameters = params, - parameter_types = param_types, - class = param_class, - classes = res$classes [[i]], - env = new.env (), - test = test, - quiet = quiet) - - test_obj <- add_int_attrs (test_obj, int_val) - - if (grepl ("\\:\\:\\:", test_obj$fn)) { - test_obj$fn <- rm_internal_namespace (test_obj$fn) - } - - if (length (params) > 0L) { - - reports <- rbind (reports, autotest_rectangular (test_obj, test_data)) - - reports <- rbind (reports, autotest_vector (test_obj, test_data)) - - reports <- rbind (reports, autotest_single (test_obj, test_data)) - - reports <- rbind (reports, autotest_return (test_obj, test_data)) - } - - reports <- rbind (reports, test_param_documentation (test_obj)) - - if (!quiet) - message (cli::col_green (cli::symbol$tick, " ", this_fn)) - } - - if (!is.null (reports)) { - - # add hash to reports - if (is.null (yaml) & !is.null (filename)) - yaml <- readLines (filename) - reports$yaml_hash <- digest::digest (yaml) - - reports <- reports [which (!duplicated (reports)), ] - - # rm "no_test" tests switched off from "test_data" - if (test) - reports <- reports [which (!reports$type == "no_test"), ] - - rownames (reports) <- NULL - } - - return (reports) -} #' autotest_package #' #' Automatically test an entire package by converting examples to `yaml` format -#' and submitting each to the \link{autotest_yaml} function. +#' and submitting each to the \link{autotest_single_trace} function. #' #' @param package Name of package, as either #' \enumerate{ @@ -185,7 +16,14 @@ autotest_single_yaml <- function (yaml = NULL, #' nominated package to be included in 'autotesting'. #' @param exclude Optional character vector containing names of any functions of #' nominated package to be excluded from 'autotesting'. -#' @inheritParams autotest_yaml +#' @param test If `FALSE`, return only descriptions of tests which would be run +#' with `test = TRUE`, without actually running them. +#' @param test_data Result returned from calling either \link{autotest_types} or +#' \link{autotest_package} with `test = FALSE` that contains a list of all tests +#' which would be conducted. These tests have an additional flag, `test`, which +#' defaults to `TRUE`. Setting any tests to `FALSE` will avoid running them when +#' `test = TRUE`. +#' @param quiet If 'FALSE', provide printed output on screen. #' @return An `autotest_package` object which is derived from a \pkg{tibble} #' `tbl_df` object. This has one row for each test, and the following nine #' columns: @@ -227,37 +65,43 @@ autotest_package <- function (package = ".", package <- dot_to_package (package) pkg_name <- preload_package (package) + pkg_dir <- get_package_loc (package) - exclude <- exclude_functions (package, functions, exclude) + traces <- autotest_trace_package (package, functions = functions, exclude = exclude) - exs <- examples_to_yaml (package, exclude = exclude, quiet = quiet) + trace_files <- list.files ( + get_typetrace_dir (), + pattern = "^typetrace\\_.*\\.Rds$", + full.names = TRUE + ) - if (!quiet) { - txt <- paste0 ("autotesting ", get_package_name (package)) - cli::cli_h2 (cli::col_green (txt)) - } + fn_pars <- get_unique_fn_pars (traces) res <- NULL - for (i in seq_along (exs)) { - yaml <- exs [[i]] - attr (yaml, "package") <- package - fn_name <- fn_from_yaml (yaml) - res <- rbind (res, - autotest_yaml (yaml = yaml, - test = test, - test_data = test_data, - quiet = TRUE)) + for (i in seq_along (trace_files)) { - if (!quiet) + res <- rbind (res, + autotest_single_trace (package, + pkg_dir, + readRDS (trace_files [i]), + fn_pars, + test = test, + test_data = test_data, + quiet = TRUE)) + + if (!quiet) { message (cli::col_green (cli::symbol$tick, " [", - i, " / ", length (exs), - "]: ", fn_name [1])) + i, " / ", length (trace_files), "]")) + } } + + typetracer::clear_traces () + res <- res [which (!duplicated (res)), ] - res <- test_untested_params (exs, res) - res <- test_fns_wo_example (package, res, names (exs)) + #res <- test_untested_params (exs, res) + #res <- test_fns_wo_example (package, res, names (exs)) if (is.null (res)) return (res) @@ -282,15 +126,101 @@ autotest_package <- function (package = ".", return (order_at_rows (res)) } -# Extract function name from yaml; used only to screen dump in autootest_package -fn_from_yaml <- function (yaml) { +get_package_loc <- function (package) { - x <- yaml::yaml.load (yaml) - nms <- vapply (x$functions, names, character (1)) - return (unique (nms)) + pkg_dir <- tryCatch (find.package (package), error = function (e) NULL) + + if (is.null (pkg_dir)) { + if (!dir.exists (package)) { + stop ("Directory ['", package, "'] does not exist", call. = FALSE) + } + } else { + package <- pkg_dir + } + return (package) } + +#' Test one 'typetracer' trace file +#' +#' @param traces A 'typetracer' trace file of function and parameter traces. +#' @param fn_pars Reduced version of 'typetracer' traces containing only unique +#' function and parameter name combinations. +#' @param test If `FALSE`, return only descriptions of tests which would be run +#' with `test = TRUE`, without actually running them. +#' @param test_data Result returned from calling either \link{autotest_types} or +#' \link{autotest_package} with `test = FALSE` that contains a list of all tests +#' which would be conducted. These tests have an additional flag, `test`, which +#' defaults to `TRUE`. Setting any tests to `FALSE` will avoid running them when +#' `test = TRUE`. +#' @param quiet If 'FALSE', provide printed output on screen. +#' @return An `autotest_pkg` object, derived from a \pkg{tibble}, detailing +#' instances of unexpected behaviour for every parameter of every function. +#' @noRd +autotest_single_trace <- function (package, + pkg_dir = NULL, + trace_data = NULL, + fn_pars, + test = TRUE, + test_data = NULL, + quiet = FALSE) { + + param_info <- get_param_info (trace_data, fn_pars) + + test_obj <- autotest_obj (package = package, + package_loc = pkg_dir, + fn_name = trace_data$fn_name, + parameters = param_info$value, + parameter_types = param_info$type, + class = param_info$class, + classes = param_info$class, + env = new.env (), + test = test, + quiet = quiet) + + int_val <- data.frame ( + fn = trace_data$fn_name, + par = param_info$name, + int_val = param_info$storage_mode == "integer" + ) + test_obj <- add_int_attrs (test_obj, int_val) + + reports <- NULL + + if (length (test_obj$params) > 0L) { + + reports <- rbind (reports, autotest_rectangular (test_obj, test_data)) + + reports <- rbind (reports, autotest_vector (test_obj, test_data)) + + reports <- rbind (reports, autotest_single (test_obj, test_data)) + + reports <- rbind (reports, autotest_return (test_obj, test_data)) + } + + reports <- rbind (reports, test_param_documentation (test_obj)) + + if (!quiet) { + message (cli::col_green (cli::symbol$tick, " ", trace_data$fn_name)) + } + + if (!is.null (reports)) { + + reports <- reports [which (!duplicated (reports)), ] + + # rm "no_test" tests switched off from "test_data" + if (test) { + reports <- reports [which (!reports$type == "no_test"), ] + } + + rownames (reports) <- NULL + } + + return (reports) +} + + #' autotest_types #' #' List all types of 'autotests' currently implemented. diff --git a/R/function-param-types.R b/R/function-param-types.R index bc49ac5d..bc9e4a02 100644 --- a/R/function-param-types.R +++ b/R/function-param-types.R @@ -1,187 +1,71 @@ - -get_param_types <- function (fn, params, par_lengths) { - - if (any (params == "NULL")) { - params <- params [params != "NULL"] - } - - single_index <- single_params (params) - vec_index <- vector_params (params) - rect_index <- tabular_params (params) - - param_types <- rep (NA_character_, length (params)) - param_types [vec_index] <- "vector" - param_types [single_index] <- "single" - param_types [rect_index] <- "tabular" - - # use par_lengths to set any parameters identified as single through usage - # in present example to vector - index <- which (par_lengths$par %in% names (params) & !par_lengths$single) - if (length (index) > 0) { - par_lengths <- par_lengths [index, , drop = FALSE] - param_types [match (par_lengths$par, names (params))] <- "vector" - } - - return (param_types) -} - -single_params <- function (params) { - - is_single <- function (j) { - chk <- FALSE - if (is.null (dim (j)) && length (j) == 1) { - if (methods::is (j, "name")) { - val <- tryCatch (eval (parse (text = j)), - error = function (e) NULL) - if (!is.null (val)) - chk <- length (val) == 1 - } else if (!isS4 (j)) { - # single objects can still be almost anything, so only - # consider as truly single those objects which have - # attribute lists each element of which have at most two - # elements. This is entirely arbitrary, and should be - # modified once more is known about the kinds of things - # thrown at this function. - lens <- vapply (attributes (j), length, integer (1)) - chk <- !any (lens > 2) - } - } else if (methods::is (j, "formula")) { - chk <- TRUE - } - return (chk) - } - - return (which (vapply (params, function (j) - is_single (j), - logical (1)))) -} - -vector_params <- function (params) { - - return (which (vapply (params, function (i) - length (i) > 1 && - is.null (dim (i)) && - is.atomic (i) && - length (class (i) <= 1L) && - any (grepl (atomic_modes (collapse = TRUE), - class (i))), - logical (1)))) -} - -tabular_params <- function (params) { - - return (which (vapply (params, function (i) - length (dim (i)) == 2 & - !(inherits (i, "Matrix") | - inherits (i, "matrix")), - logical (1)))) -} - -#' single_or_vec +#' Get names, values, types and classes of parameters #' -#' Do different usages within a single yaml indicate whether a parameter is -#' restricted to length one, or whether it can be a vector with length > 1? -#' @param res The parsed yaml returned from `parse_yaml_template`. +#' @param trace_data Result of a single 'typetracer' trace. +#' @param fn_pars Result of \link{get_unique_fn_pars} applied to a single trace. +#' @return A `list` of 4 item of "value", "type" and "class", and "storage_mode" +#' of each parameter, where "type" is one of "single", "vector", or "tabular" +#' (or otherwise NA). #' @noRd -single_or_vec <- function (res) { - - fns <- unique (names (res$parameters)) - - pkg_namespace <- paste0 ("package:", res$package) - pkg_env <- new.env (parent = as.environment (pkg_namespace)) - - pars <- lapply (fns, function (f) { - - pars <- res$parameters [names (res$parameters) == f] - pars <- lapply (pars, function (i) { - nms <- names (unlist (i)) - lens <- vapply (nms, function (j) { - ij <- unlist (i) [[j]] - out <- length (ij) - if (methods::is (ij, "name")) { - tmp <- tryCatch ( - eval (parse (text = ij), - envir = pkg_env), - error = function (e) NULL) - if (!is.null (tmp)) - out <- length (tmp) - } - return (out) - }, - integer (1)) - data.frame (name = nms, - len = lens) }) - - pars <- data.frame (do.call (rbind, unname (pars))) - pars <- lapply (split (pars, f = as.factor (pars$name)), - function (i) - i [which.max (i$len), , drop = FALSE]) - - pars <- do.call (rbind, pars) - - data.frame (fn = f, - par = pars$name, - single = pars$len == 1, - stringsAsFactors = FALSE) - }) - - return (do.call (rbind, pars)) +get_param_info <- function (trace_data, fn_pars) { + + # get parameter values: + par_index <- which (!nzchar (names (trace_data))) + par_names_i <- vapply (trace_data [par_index], function (j) j$par, character (1L)) + par_vals_i <- lapply (trace_data [par_index], function (j) j$par_eval) + names (par_vals_i) <- par_names_i + index <- which (!vapply (par_vals_i, is.null, logical (1L))) + par_vals_i <- par_vals_i [index] + par_names_i <- par_names_i [index] + + # get parameter classes & types: + index <- which (fn_pars$fn_name == trace_data$fn_name & + fn_pars$par_name %in% par_names_i) + fn_pars_i <- fn_pars [index, ] + fn_pars_i <- fn_pars_i [match (fn_pars_i$par_name, par_names_i), ] + + index <- which (par_names_i %in% fn_pars_i$par_name) + par_vals_i <- par_vals_i [index] + par_names_i <- par_names_i [index] + + # param_types are in [single, vector, tabular] + param_types <- rep (NA_character_, nrow (fn_pars_i)) + + is_single <- vapply (fn_pars_i$length, function (j) + all (as.integer (strsplit (j, ",") [[1]]) <= 1L), + logical (1L)) + param_types [which (is_single)] <- "single" + + is_vector <- vapply (fn_pars_i$length, function (j) + any (as.integer (strsplit (j, ",") [[1]]) > 1L), + logical (1L)) + param_types [which (is_vector)] <- "vector" + + is_rect <- vapply (trace_data [par_index], function (j) + j$typeof == "list" && length (dim (j$par_eval)) == 2, + logical (1L)) + param_types [which (is_rect)] <- "tabular" + + # reduce class to first non-generic value only + # start by removing generic classes, which may be first of several items, so + # first remove all ", " versions. + atomics <- paste0 (atomic_modes (), collapse = "|") + atomics <- paste0 (atomics, "|matrix|array|data\\.frame") + ptn <- paste0 ("(", atomics, "),\\s*") + param_class <- gsub (ptn, "", fn_pars_i$class) + param_class <- gsub (atomics, "", param_class) + param_class <- gsub ("^\\,\\s+", "", param_class) + + param_class [which (!nzchar (param_class))] <- NA_character_ + + data.frame ( + name = par_names_i, + value = I (par_vals_i), + type = param_types, + class = param_class, + storage_mode = fn_pars_i$storage_mode + ) } -#' double_or_int -#' -#' Do different usages within a single yaml indicate whether a single-length -#' parameter is intended to be an integer, yet without `L`, or whether it is -#' indeed a double? -#' @param res The parsed yaml returned from `parse_yaml_template`. -#' @noRd -double_or_int <- function (res) { - - fns <- unique (names (res$parameters)) - - is_par_int <- function (p) { - ret <- FALSE - if (is.numeric (p)) - ret <- all (abs (p - round (p)) < .Machine$double.eps) - if (!is.null (attr (p, "is_int"))) - if (!attr (p, "is_int")) - ret <- FALSE - return (ret) - } - - pars <- lapply (fns, function (f) { - - pars <- res$parameters [names (res$parameters) == f] [[1]] - nms <- vapply (pars, names, character (1)) - pars <- lapply (pars, function (i) i [[1]]) - names (pars) <- nms - - pars <- lapply (seq_along (pars), function (i) { - nms <- names (pars) [i] - int_val <- is_par_int (pars [[i]]) - data.frame (name = nms, - int_val = int_val) - }) - - pars <- data.frame (do.call (rbind, unname (pars))) - pars <- lapply (split (pars, f = as.factor (pars$name)), - function (i) { - int_val <- all (i$int_val) - i <- i [1, ] - i$int_val <- int_val - return (i) - }) - - pars <- do.call (rbind, pars) - - data.frame (fn = f, - par = pars$name, - int_val = pars$int_val, - stringsAsFactors = FALSE) - }) - - return (do.call (rbind, pars)) -} # add attributes to elements of `autotest_object` `x` identifying any parameters # which are exclusively used as `int`, but not explicitly specified as such diff --git a/R/typetrace-package.R b/R/typetrace-package.R new file mode 100644 index 00000000..64025724 --- /dev/null +++ b/R/typetrace-package.R @@ -0,0 +1,101 @@ +# Trace a package with 'typetracer' + +get_typetrace_dir <- function () { + + td <- getOption ("typetracedir") + if (is.null (td)) { + td <- tempdir () + } + return (td) +} + +autotest_trace_package <- function (package, + functions = NULL, + exclude = NULL) { + + + package <- dot_to_package (package) + pkg_name <- preload_package (package) + + functions <- include_functions (package, functions, exclude) + + Sys.setenv ("TYPETRACER_LEAVE_TRACES" = "true") + if (pkg_name != package) { + if (!dir.exists (package)) { + stop ("'package' should be a local directory.") + } + args <- list (pkg_dir = package) + } else { + args <- list (package = package) + } + if (!is.null (functions)) { + args$functions = functions + } + + traces <- do.call (typetracer::trace_package, args) + + Sys.unsetenv ("TYPETRACER_LEAVE_TRACES") # traces are still there + + return (traces) +} + +# combine lists of `functions` to include and `exclude` into single vector +include_functions <- function (package, functions = NULL, exclude = NULL) { + + fns <- m_get_pkg_functions (package) + + err_chk <- function (fn_arg, fns, package) { + if (!all (fn_arg %in% fns)) { + fn_arg <- fn_arg [which (!fn_arg %in% fns)] + stop ("The following functions are not in the namespace of ", + "package:", package, ": [", + paste0 (fn_arg, collapse = ", "), "]", + call. = FALSE) + } + } + + if (!is.null (functions)) { + + err_chk (functions, fns, package) + fns <- fns [which (fns %in% functions)] + + } else if (!is.null (exclude)) { + + err_chk (exclude, fns, package) + fns <- fns [which (!fns %in% exclude)] + } + + return (fns) +} + +#' Get all (unique) parameter names from all traced functions. +#' +#' @param traces Result of 'typetracer::trace_package()' call. +#' @return Reduced version of 'traces' with only unique parameter names. +#' @noRd +get_unique_fn_pars <- function (traces) { + + fn_pars <- unique (traces [, c ("fn_name", "par_name")]) + + par_types <- lapply (seq (nrow (fn_pars)), function (i) { + index <- which (traces$fn_name == fn_pars$fn_name [i] & + traces$par_name == fn_pars$par_name [i]) + onecol <- function (traces, index, what = "classes") { + res <- traces [[what]] [index] + if (is.list (res)) { + res <- do.call (c, res) + } + res <- unique (res) + paste0 (res [which (!res == "NULL")], collapse = ", ") + } + data.frame ( + class = onecol (traces, index, "class"), + typeof = onecol (traces, index, "typeof"), + mode = onecol (traces, index, "mode"), + storage_mode = onecol (traces, index, "storage_mode"), + length = onecol (traces, index, "length") + ) + }) + + return (cbind (fn_pars, do.call (rbind, par_types))) +} diff --git a/codemeta.json b/codemeta.json index ce117c1c..1982df08 100644 --- a/codemeta.json +++ b/codemeta.json @@ -8,7 +8,7 @@ "codeRepository": "https://github.com/ropensci-review-tools/autotest", "issueTracker": "https://github.com/ropensci-review-tools/autotest/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.0.2.204", + "version": "0.0.2.206", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", @@ -278,6 +278,18 @@ "sameAs": "https://CRAN.R-project.org/package=tibble" }, "12": { + "@type": "SoftwareApplication", + "identifier": "typetracer", + "name": "typetracer", + "provider": { + "@id": "https://cran.r-project.org", + "@type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "sameAs": "https://github.com/mpadge/typetracer" + }, + "13": { "@type": "SoftwareApplication", "identifier": "withr", "name": "withr", @@ -289,7 +301,7 @@ }, "sameAs": "https://CRAN.R-project.org/package=withr" }, - "13": { + "14": { "@type": "SoftwareApplication", "identifier": "yaml", "name": "yaml", @@ -303,7 +315,7 @@ }, "SystemRequirements": {} }, - "fileSize": "570.294KB", + "fileSize": "487.484KB", "readme": "https://github.com/ropensci-review-tools/autotest/blob/main/README.md", "contIntegration": [ "https://github.com/ropensci-review-tools/autotest/actions?query=workflow%3AR-CMD-check", diff --git a/man/at_yaml_template.Rd b/man/at_yaml_template.Rd index c18822fc..2532737b 100644 --- a/man/at_yaml_template.Rd +++ b/man/at_yaml_template.Rd @@ -16,7 +16,6 @@ Generate a 'yaml' template for an 'autotest'. } \seealso{ Other yaml: -\code{\link{autotest_yaml}()}, \code{\link{examples_to_yaml}()} } \concept{yaml} diff --git a/man/autotest-package.Rd b/man/autotest-package.Rd index fdff8759..d1dd4a37 100644 --- a/man/autotest-package.Rd +++ b/man/autotest-package.Rd @@ -18,7 +18,12 @@ Useful links: } \author{ -\strong{Maintainer}: Mark Padgham \email{mark.padgham@email.com} +\strong{Maintainer}: Mark Padgham \email{mark.padgham@email.com} (\href{https://orcid.org/0000-0003-2172-5265}{ORCID}) + +Other contributors: +\itemize{ + \item Jouni Helske (\href{https://orcid.org/0000-0001-7130-793X}{ORCID}) [contributor] +} } \keyword{internal} diff --git a/man/autotest_package.Rd b/man/autotest_package.Rd index 17dce430..40b64ae8 100644 --- a/man/autotest_package.Rd +++ b/man/autotest_package.Rd @@ -64,7 +64,7 @@ Some columns may contain NA values, as explained in the Note. } \description{ Automatically test an entire package by converting examples to \code{yaml} format -and submitting each to the \link{autotest_yaml} function. +and submitting each to the \link{autotest_single_trace} function. } \note{ Some columns may contain NA values, including: diff --git a/man/autotest_yaml.Rd b/man/autotest_yaml.Rd deleted file mode 100644 index e55b1591..00000000 --- a/man/autotest_yaml.Rd +++ /dev/null @@ -1,54 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/autotest-functions.R -\name{autotest_yaml} -\alias{autotest_yaml} -\title{autotest_yaml} -\usage{ -autotest_yaml( - yaml = NULL, - filename = NULL, - test = TRUE, - test_data = NULL, - quiet = FALSE -) -} -\arguments{ -\item{yaml}{A 'yaml' template as a character vector, either hand-coded or -potentially loaded via \link{readLines} function or similar. Should generally -be left at default of 'NULL', with template specified by 'filename' -parameter.} - -\item{filename}{Name (potentially including path) of file containing 'yaml' -template. See \link{at_yaml_template} for details of template. Default uses -template generated by that function, and held in local './tests' directory.} - -\item{test}{If \code{FALSE}, return only descriptions of tests which would be run -with \code{test = TRUE}, without actually running them.} - -\item{test_data}{Result returned from calling either \link{autotest_types} or -\link{autotest_package} with \code{test = FALSE} that contains a list of all tests -which would be conducted. These tests have an additional flag, \code{test}, which -defaults to \code{TRUE}. Setting any tests to \code{FALSE} will avoid running them when -\code{test = TRUE}.} - -\item{quiet}{If 'FALSE', provide printed output on screen.} -} -\value{ -An \code{autotest_pkg} object, derived from a \pkg{tibble}, detailing -instances of unexpected behaviour for every parameter of every function. -} -\description{ -Automatically test inputs to functions specified in a 'yaml' template. -} -\examples{ -\dontrun{ -yaml_list <- examples_to_yaml (package = "stats", functions = "reshape") -res <- autotest_yaml (yaml = yaml_list) -} -} -\seealso{ -Other yaml: -\code{\link{at_yaml_template}()}, -\code{\link{examples_to_yaml}()} -} -\concept{yaml} diff --git a/man/examples_to_yaml.Rd b/man/examples_to_yaml.Rd index 136bba19..bddc1e4d 100644 --- a/man/examples_to_yaml.Rd +++ b/man/examples_to_yaml.Rd @@ -35,7 +35,6 @@ automatically test package. } \seealso{ Other yaml: -\code{\link{at_yaml_template}()}, -\code{\link{autotest_yaml}()} +\code{\link{at_yaml_template}()} } \concept{yaml}