Skip to content

Commit

Permalink
Tweak tests to work also in R (< 4.1.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Feb 11, 2025
1 parent f39879c commit 05ac2ea
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: future
Version: 1.34.0-9119
Version: 1.34.0-9120
Title: Unified Parallel and Distributed Processing in R for Everyone
Imports:
digest,
Expand Down
4 changes: 4 additions & 0 deletions tests/demo.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
source("incl/start.R")

## Avoid 'Error: C stack usage 7971940 is too close to the limit'
## on R (< 4.1.0)
if (getRversion() < "4.1") options(future.debug = FALSE)

message("*** Demos ...")

message("*** Fibonacci demo of the 'future' package ...")
Expand Down
7 changes: 6 additions & 1 deletion tests/future,optsenvvars.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,14 @@ for (strategy in strategies) {

## Any changed?
for (name in names(old_envvars)) {
if (!identical(envvars[[name]], old_envvars[[name]])) {
if (getRversion() < "4.1.0") {
old_envvars[[name]] <- sub("=$", "", old_envvars[[name]])
}
if (!identical(envvars[[name]], old_envvars[[name]])) {
stop(sprintf("Detected modified environment variable: %s=%s (was %s)", name, sQuote(envvars[[name]]), sQuote(old_envvars[[name]])))
stop(sprintf("Detected modified environment variable: %s=%s (was %s)", name, sQuote(envvars[[name]]), sQuote(old_envvars[[name]])))
}
}
}

stopifnot(all.equal(envvars, old_envvars))
Expand Down

0 comments on commit 05ac2ea

Please sign in to comment.