Skip to content

Commit 432f266

Browse files
TESTS: Adjust tests accordingly
1 parent 2189b67 commit 432f266

File tree

2 files changed

+12
-44
lines changed

2 files changed

+12
-44
lines changed

tests/futureCall.R

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,10 @@ for (cores in 1:availCores) {
6464
if (globals) {
6565
stopifnot(all.equal(v1, v0))
6666
} else {
67-
if (!lazy && strategy %in% c("sequential", "multicore")) {
68-
stopifnot(all.equal(v1, v0))
69-
} else {
70-
stopifnot(inherits(res1, "error"))
71-
}
67+
stopifnot(inherits(res1, "error"))
7268
}
7369
} else {
7470
if (!inherits(res1, "error")) {
75-
utils::str(list(strategy = strategy, globals = globals, lazy = lazy, v0 = v0, v1 = v1))
7671
stopifnot(all.equal(v1, v0))
7772
} else {
7873
stopifnot(!globals)
@@ -93,14 +88,9 @@ for (cores in 1:availCores) {
9388
utils::str(list(strategy = strategy, globals = globals, lazy = lazy, v0 = v0, res2 = res2))
9489
if (isTRUE(as.logical(Sys.getenv("R_CHECK_IDEAL")))) {
9590
message("R_CHECK_IDEAL=TRUE")
96-
if (globals) {
97-
stopifnot(all.equal(v2, v0))
98-
} else {
99-
stopifnot(all.equal(v2, v0))
100-
}
91+
stopifnot(all.equal(v2, v0))
10192
} else {
10293
if (!inherits(res2, "error")) {
103-
utils::str(list(strategy = strategy, globals = globals, lazy = lazy, v0 = v0, v2 = v2))
10494
stopifnot(all.equal(v2, v0))
10595
} else {
10696
stopifnot(!globals)
@@ -120,14 +110,9 @@ for (cores in 1:availCores) {
120110
utils::str(list(strategy = strategy, globals = globals, lazy = lazy, v0 = v0, res3 = res3))
121111
if (isTRUE(as.logical(Sys.getenv("R_CHECK_IDEAL")))) {
122112
message("R_CHECK_IDEAL=TRUE")
123-
if (globals) {
124-
stopifnot(all.equal(v3, v0))
125-
} else {
126-
stopifnot(all.equal(v3, v0))
127-
}
113+
stopifnot(all.equal(v3, v0))
128114
} else {
129115
if (!inherits(res3, "error")) {
130-
utils::str(list(strategy = strategy, globals = globals, lazy = lazy, v0 = v0, v3 = v3, res3 = res3))
131116
stopifnot(all.equal(v3, v0))
132117
} else {
133118
stopifnot(!globals)
@@ -163,10 +148,12 @@ for (cores in 1:availCores) {
163148
message("future.globals.globalsOf.locals=TRUE")
164149
if (globals) {
165150
stopifnot(identical(v4, truth))
166-
} else if (lazy) {
167-
stopifnot(inherits(v4, "error"))
168151
} else {
169-
stopifnot(identical(v4, truth))
152+
if (lazy) {
153+
stopifnot(inherits(v4, "error"))
154+
} else {
155+
stopifnot(identical(v4, truth))
156+
}
170157
}
171158
} else {
172159
message("future.globals.globalsOf.locals=FALSE")
@@ -182,23 +169,12 @@ for (cores in 1:availCores) {
182169
message("future.globals.globalsOf.locals=TRUE")
183170
if (globals) {
184171
stopifnot(identical(v4, truth))
185-
} else if (lazy) {
186-
stopifnot(inherits(v4, "error"))
187-
} else if (strategy %in% c("sequential", "multicore")) {
188-
stopifnot(inherits(v4, "error"))
189172
} else {
190173
stopifnot(inherits(v4, "error"))
191174
}
192175
} else {
193176
message("future.globals.globalsOf.locals=FALSE")
194-
if (strategy %in% c("sequential", "multicore")) {
195-
stopifnot(inherits(v4, "error"))
196-
} else if (lazy) {
197-
stopifnot(inherits(v4, "error"))
198-
} else {
199-
stopifnot(inherits(v4, "error"))
200-
# stopifnot(identical(v4, truth))
201-
}
177+
stopifnot(inherits(v4, "error"))
202178
}
203179
}
204180
})

tests/globals,locals.R

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ for (strategy in supportedStrategies()) {
8787
if (isTRUE(getOption("future.globals.globalsOf.locals", TRUE))) {
8888
message("future.globals.globalsOf.locals=TRUE")
8989
if (strategy %in% c("sequential", "multicore")) {
90-
stopifnot(inherits(res, "error"))
90+
stopifnot(identical(v, truth))
9191
} else {
9292
stopifnot(identical(v, truth))
9393
}
@@ -145,18 +145,10 @@ for (strategy in supportedStrategies()) {
145145
message("future.globals.keepWhere=FALSE")
146146
if (isTRUE(getOption("future.globals.globalsOf.locals", TRUE))) {
147147
message("future.globals.globalsOf.locals=TRUE")
148-
if (strategy %in% c("sequential", "multicore")) {
149-
stopifnot(identical(v, 4)) ## <= SERIOUS BUG!
150-
} else {
151-
stopifnot(identical(v, 4)) ## <= SERIOUS BUG!
152-
}
148+
stopifnot(identical(v, 4)) ## <= SERIOUS BUG!
153149
} else {
154150
message("future.globals.globalsOf.locals=FALSE")
155-
if (strategy %in% c("sequential", "multicore")) {
156-
stopifnot(inherits(v, "error"))
157-
} else {
158-
stopifnot(identical(v, truth))
159-
}
151+
stopifnot(inherits(v, "error"))
160152
}
161153
}
162154
} ## for (strategy ...)

0 commit comments

Comments
 (0)