Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: hadley/testthat
base: 585f27d165
...
head fork: hadley/testthat
compare: 74d177c8ab
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 7 additions and 2 deletions.
  1. +3 −0  NEWS
  2. +4 −2 R/auto-test.r
View
3  NEWS
@@ -14,6 +14,9 @@
* Depend on `methods` rather than requiring it so that testthat works when run
from `Rscript`
+* `auto_test` now normalises paths to enable better identification of file
+ changes, and fixes bug in instantiating new reporter object.
+
Version 0.6
------------------------------------------------------------------------------
View
6 R/auto-test.r
@@ -33,6 +33,8 @@
#' @keywords debugging
auto_test <- function(code_path, test_path, reporter = "summary", env = NULL) {
reporter <- find_reporter(reporter)
+ code_path <- normalizePath(code_path)
+ test_path <- normalizePath(test_path)
# Start by loading all code and running all tests
if (is.null(env)) {
@@ -47,7 +49,7 @@ auto_test <- function(code_path, test_path, reporter = "summary", env = NULL) {
# Next set up watcher to monitor changes
watcher <- function(added, deleted, modified) {
- changed <- c(added, modified)
+ changed <- normalizePath(c(added, modified))
tests <- changed[starts_with(changed, test_path)]
code <- changed[starts_with(changed, code_path)]
@@ -61,7 +63,7 @@ auto_test <- function(code_path, test_path, reporter = "summary", env = NULL) {
} else if (length(tests) > 0) {
# If test changes, rerun just that test
cat("Rerunning tests: ", str_c(basename(tests), collapse = ", "), "\n")
- with_reporter(reporter$new(), lapply(tests, sys.source,
+ with_reporter(reporter$getRefClass()$new(), lapply(tests, sys.source,
env = new.env(parent = env), chdir = TRUE))
}

No commit comments for this range

Something went wrong with that request. Please try again.