Skip to content

Commit 2e13ee0

Browse files
TESTS: Increase test coverage
1 parent e039a49 commit 2e13ee0

File tree

5 files changed

+60
-1
lines changed

5 files changed

+60
-1
lines changed

tests/handlers.R

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,24 @@ message("handlers() ...")
55
hs <- handlers()
66
print(hs)
77

8+
for (kk in seq_along(hs)) {
9+
h <- hs[[kk]]
10+
print(h)
11+
handler <- h()
12+
print(handler)
13+
}
14+
15+
816
hs <- handlers("txtprogressbar")
917
print(hs)
10-
print(hs[[1]])
18+
19+
for (kk in seq_along(hs)) {
20+
h <- hs[[kk]]
21+
print(h)
22+
handler <- h()
23+
print(handler)
24+
}
25+
1126

1227
message("handlers() ... DONE")
1328

tests/incl/start,load-only.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ oopts0 <- options()
66
## Default options for tests
77
oopts <- options()
88

9+
check_full <- isTRUE(as.logical(Sys.getenv("R_CHECK_FULL", "FALSE")))
10+
911
## Private
1012
`%||%` <- progressr:::`%||%`
1113
hpaste <- progressr:::hpaste
@@ -30,6 +32,11 @@ non_supported_progression_handlers <- function() {
3032
if (.Platform$OS.type != "windows") {
3133
names <- c(names, "winprogressbar")
3234
}
35+
if (!check_full) {
36+
names <- c(names, "notifier")
37+
names <- c(names, "shiny")
38+
}
39+
names <- unique(names)
3340
paste0(names, "_handler")
3441
}
3542

tests/progressor.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
source("incl/start.R")
2+
3+
message("progressor() ...")
4+
5+
p <- progressor(3L)
6+
print(p)
7+
8+
p <- progressor(along = 1:3)
9+
print(p)
10+
11+
message("progressor() ... DONE")
12+
13+
source("incl/end.R")

tests/utils.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ print(in_r_cmd_check())
9696
message("*** in_r_cmd_check() ... done")
9797

9898

99+
message("*** .onLoad() ...")
100+
101+
progressr:::.onLoad(pkgname = "progressr")
102+
103+
message("*** .onLoad() ... done")
104+
99105
message("*** utils ... DONE")
100106

101107
source("incl/end.R")

tests/zzz,shiny.R

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
source("incl/start.R")
2+
3+
if (requireNamespace("shiny", quietly = TRUE)) {
4+
## This will generate:
5+
## Error in shiny::withProgress(expr, ..., env = env, quoted = TRUE) :
6+
## 'session' is not a ShinySession object.
7+
tryCatch({
8+
withProgressShiny({
9+
p <- progressor(3L)
10+
y <- lapply(1:3, function(n) {
11+
p()
12+
slow_sum(1:n, stdout=TRUE, message=TRUE)
13+
})
14+
})
15+
}, error = identity)
16+
}
17+
18+
source("incl/end.R")

0 commit comments

Comments
 (0)