Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test dots #747

Merged
merged 2 commits into from
Apr 21, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* `system_check()` combines arguments with ` `, not `, `. (#753)

* `lint()` gains a `cache` argument (@jimhester, #708).
* `test()` gains an `...` argument so that additional arguments can be passed
to `testthat::test_dir` (@jimhester, #747)

* export functions `RCMD()` and `system_check()` so they can be used by other
packages. (@jimhester, #699).
Expand Down
5 changes: 3 additions & 2 deletions R/test.r
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
#'
#' @param pkg package description, can be path or package name. See
#' \code{\link{as.package}} for more information
#' @param ... additional arguments passed to \code{\link[testthat]{test_dir}}
#' @inheritParams testthat::test_dir
#' @inheritParams run_examples
#' @export
test <- function(pkg = ".", filter = NULL) {
test <- function(pkg = ".", filter = NULL, ...) {
check_testthat()
pkg <- as.package(pkg)

Expand Down Expand Up @@ -46,7 +47,7 @@ test <- function(pkg = ".", filter = NULL) {
Sys.sleep(0.05); flush.console() # Avoid misordered output in RStudio

env <- new.env(parent = ns_env)
with_envvar(r_env_vars(), testthat::test_dir(test_path, filter = filter, env = env))
with_envvar(r_env_vars(), testthat::test_dir(test_path, filter = filter, env = env, ...))
}

find_test_dir <- function(path) {
Expand Down
4 changes: 3 additions & 1 deletion man/test.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
\alias{test}
\title{Execute all \pkg{test_that} tests in a package.}
\usage{
test(pkg = ".", filter = NULL)
test(pkg = ".", filter = NULL, ...)
}
\arguments{
\item{pkg}{package description, can be path or package name. See
Expand All @@ -13,6 +13,8 @@ test(pkg = ".", filter = NULL)
\item{filter}{If not \code{NULL}, only tests with file names matching this
regular expression will be executed. Matching will take on the file
name after it has been stripped of \code{"test-"} and \code{".r"}.}

\item{...}{additional arguments passed to \code{\link[testthat]{test_dir}}}
}
\description{
Tests are assumed to be located in either the \code{inst/tests/} or
Expand Down