Skip to content

Commit

Permalink
mirror hash parameter in auto_tests
Browse files Browse the repository at this point in the history
In order to enable switching to the faster, time-stamp-based modification detection.
  • Loading branch information
Katrin Leinweber committed Jun 7, 2017
1 parent c7e8330 commit ea55ac0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@

* New JUnit reporter `JunitReporter`. (#481, @lbartnik)

* Mirror `hash` parameter in `auto_test()` and `auto_test_package()` in order
to enable switching to faster, time-stamp-based modification detection
(#598, @katrinleinweber)

# testthat 1.0.2

* Ensure `std::logic_error()` constructed with `std::string()`
Expand Down
13 changes: 9 additions & 4 deletions R/auto-test.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@
#' @param test_path path to directory containing tests
#' @param reporter test reporter to use
#' @param env environment in which to execute test suite.
#' @param hash Passed on to [watch()]. When FALSE, uses less accurate
#' modification time stamps, but those are faster for large files.
#' @keywords debugging
auto_test <- function(code_path, test_path, reporter = default_reporter(),
env = test_env()) {
env = test_env(),
hash = TRUE) {
reporter <- find_reporter(reporter)
code_path <- normalizePath(code_path)
test_path <- normalizePath(test_path)
Expand Down Expand Up @@ -57,7 +60,7 @@ auto_test <- function(code_path, test_path, reporter = default_reporter(),

TRUE
}
watch(c(code_path, test_path), watcher)
watch(c(code_path, test_path), watcher, hash = hash)

}

Expand All @@ -66,9 +69,11 @@ auto_test <- function(code_path, test_path, reporter = default_reporter(),
#' @param pkg path to package
#' @export
#' @param reporter test reporter to use
#' @param hash Passed on to [watch()]. When FALSE, uses less accurate
#' modification time stamps, but those are faster for large files.
#' @keywords debugging
#' @seealso [auto_test()] for details on how method works
auto_test_package <- function(pkg = ".", reporter = default_reporter()) {
auto_test_package <- function(pkg = ".", reporter = default_reporter(), hash = TRUE) {
if (!requireNamespace("devtools", quietly = TRUE)) {
stop("devtools required to run auto_test_package(). Please install.",
call. = FALSE)
Expand Down Expand Up @@ -114,6 +119,6 @@ auto_test_package <- function(pkg = ".", reporter = default_reporter()) {

TRUE
}
watch(c(code_path, test_path), watcher)
watch(c(code_path, test_path), watcher, hash = hash)

}
5 changes: 4 additions & 1 deletion man/auto_test.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/auto_test_package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ea55ac0

Please sign in to comment.