Skip to content

Commit 2b7233e

Browse files
author
osenan
committed
refactor: improve message and test if specific message is triggered when warning
1 parent cecbd73 commit 2b7233e

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

R/qenv-within.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ side_effect_functions <- c("set.seed", "options", "Sys.setenv")
5656
within.qenv <- function(data, expr, ...) {
5757
expr <- as.expression(substitute(expr))
5858
if (grepl(paste(side_effect_functions, collapse = "|"), as.character(expr))) {
59-
warning("Calls to options and set.seed might not be reproducible with `get_code`, use `eval_code` instead")
59+
warning("Calls to side effect functions might not be reproducible with `get_code`, use `eval_code` instead")
6060
}
6161
extras <- list(...)
6262
# Inject extra values into expressions.

tests/testthat/test-qenv_within.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,8 @@ testthat::test_that("within triggers warning if side_effect_functions used", {
126126
set.seed(2)
127127
a <- runif(1)
128128
})
129-
})
129+
},
130+
"Calls to side effect functions might not be reproducible with `get_code`, use `eval_code` instead")
130131

131132
testthat::expect_warning({
132133
within(qenv(), {

0 commit comments

Comments
 (0)