File: test-load.r

package info (click to toggle)
r-cran-pkgload 1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 788 kB
  • sloc: ansic: 30; sh: 13; cpp: 9; makefile: 2
file content (21 lines) | stat: -rw-r--r-- 577 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
context("Loading")

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

test_that("helpers are available after load_all", {
  load_all("testLoadHelpers")

  # object defined R/
  expect_equal(baz, 1)

  # object defined in a helper
  expect_equal(foo, 1)

  # object definde in helper, referencing lazy data object mtcars2
  expect_equal(head_mtcars, head(mtcars2))

  unload("testLoadHelpers")
})