-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest_manuals.R
More file actions
41 lines (36 loc) · 1.51 KB
/
test_manuals.R
File metadata and controls
41 lines (36 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
tmpRoot <- tempdir()
repoRoot <- file.path("inst", "unitTests", "repo")
bioc <- file.path(tmpRoot, "repo", "bioc")
annotation <- file.path(tmpRoot, "repo", "data", "annotation")
experiment <- file.path(tmpRoot, "repo", "data", "experiment")
srcContrib <- file.path("src", "contrib")
builds <- c("bioc", annotation, experiment)
copyToTmp <- function() {
if (!dir.exists(tmpRoot))
dir.create(tmpRoot)
file.copy(repoRoot, tmpRoot, recursive = TRUE)
}
filesExist <- function(path, pkg) {
file_list <- list.files(path, recursive = TRUE)
paste0(pkg, ".html") %in% file_list && paste0(pkg, ".pdf") %in% file_list
}
test_extractManuals <- function() {
copyToTmp()
# check all manuals processed
# package with manual
checkEquals(extractManuals(bioc, srcContrib),
"1 / 1 tarball manuals processed")
# package without a manual
checkEquals(extractManuals(annotation, srcContrib),
"1 / 1 tarball manuals processed")
# package without a manual
checkEquals(extractManuals(experiment, srcContrib),
"1 / 1 tarball manuals processed")
# check for both html and pdf files
myBiocPkgMan <- file.path(bioc, "manuals", "myBiocPkg", "man")
checkTrue(filesExist(myBiocPkgMan, "myBiocPkg"))
myAnnPkgMan <- file.path(annotation, "manuals", "myAnnPkg", "man")
checkTrue(filesExist(myAnnPkgMan, "myAnnPkg"))
myExpPkgMan <- file.path(experiment, "manuals", "myExpPkg", "man")
checkTrue(filesExist(myExpPkgMan, "myExpPkg"))
}