Skip to content

Commit fd82540

Browse files
TESTS: Add test for 'batchtools_bash'
1 parent 550fadb commit fd82540

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: future.batchtools
2-
Version: 0.12.2-9935
2+
Version: 0.12.2-9936
33
Depends:
44
R (>= 3.2.0),
55
parallelly,

inst/testme/test-batchtools_bash.R

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#' @tags skip_on_cran
2+
#' @tags batchtools_bash
3+
4+
library(future)
5+
library(listenv)
6+
7+
message("*** batchtools_bash() ...")
8+
9+
bin <- Sys.which("bash")
10+
if (utils::file_test("-f", bin)) {
11+
plan(future.batchtools::batchtools_bash)
12+
print(plan())
13+
14+
message("*** Launch future")
15+
16+
f <- future({
17+
42L
18+
})
19+
stopifnot(inherits(f, "BatchtoolsFuture"))
20+
21+
y <- value(f)
22+
print(y)
23+
stopifnot(y == 42L)
24+
25+
26+
message("*** Launch future with run-time error")
27+
f <- future({
28+
stop("Whoops!")
29+
1
30+
})
31+
v <- value(f, signal = FALSE)
32+
print(v)
33+
stopifnot(inherits(v, "error"))
34+
} else {
35+
message("Skipping: 'bash' is not available")
36+
}
37+
38+
message("*** batchtools_bash() ... DONE")
39+

0 commit comments

Comments
 (0)