Skip to content

Commit

Permalink
Merge 1b4e601 into 57c93d4
Browse files Browse the repository at this point in the history
  • Loading branch information
krlmlr committed May 26, 2015
2 parents 57c93d4 + 1b4e601 commit d6adf12
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions R/load.r
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
#' @param pkg package description, can be path or package name. See
#' \code{\link{as.package}} for more information. If the \code{DESCRIPTION}
#' file does not exist, it is created using \code{\link{create_description}}.
#' (This means that only the precise path to the package, but not to a
#' subdirectory in the package, are accepted here.)
#' @param reset clear package environment and reset file cache before loading
#' any pieces of the package. This is equivalent to running
#' \code{\link{unload}} and is the default. Use \code{reset = FALSE} may be
Expand Down
5 changes: 0 additions & 5 deletions tests/testthat/test-load-dir.r

This file was deleted.

10 changes: 10 additions & 0 deletions tests/testthat/test-load.r
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
context("Loading")

test_that("Package root is working directory when loading", {
expect_message(load_all("testLoadDir"), "[|].*/testLoadDir[|]")
})

test_that("Loading a package subdirectory throws an error", {
expect_error(load_all(file.path("testLoadDir", "R")),
"does not look like a package")
})
4 changes: 2 additions & 2 deletions tests/testthat/test-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ context('package')

test_that("it can load from outside of package root", {
expect_false('testHooks' %in% loadedNamespaces())
load_all(file.path("testHooks", "R"))
load_all(file.path("testHooks"))
expect_true('testHooks' %in% loadedNamespaces())
unload(file.path("testHooks", "R"))
unload(file.path("testHooks"))
expect_false('testHooks' %in% loadedNamespaces())
})

0 comments on commit d6adf12

Please sign in to comment.