File: testUserLoadHook.R

package info (click to toggle)
r-cran-pkgload 1.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,164 kB
  • sloc: sh: 13; cpp: 9; ansic: 8; makefile: 2
file content (15 lines) | stat: -rw-r--r-- 445 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
.onLoad <- function(...) {
  stopifnot(!environmentIsLocked(asNamespace("testUserLoadHook")))

  setHook(
    packageEvent("testUserLoadHookUpstream", "onLoad"),
    function(...) {
      stopifnot(environmentIsLocked(asNamespace("testUserLoadHookUpstream")))

      # The package exports are populated when user onLoad hooks are run
      stopifnot(is.null(testUserLoadHookUpstream::foo()))

      rlang::signal("", "hook_was_run")
    }
  )
}