From b8923e9497778b3dfba54c8a054590f88e96998f Mon Sep 17 00:00:00 2001 From: Carson Sievert Date: Tue, 3 Oct 2023 10:54:55 -0500 Subject: [PATCH] Address r-devel's change in `is.atomic(NULL)` behavior (#3908) --- NEWS.md | 2 ++ R/utils.R | 6 ++---- tests/testthat/test-tabPanel.R | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 48ffc03fef..d3c7fb971f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,6 +12,8 @@ * Fixed #3898: `wrapFunctionLabel()` no longer throws an error if the `name` is longer than 10000 bytes. (#3903) +* On r-devel (R > 4.3.1), `isTruthy(NULL)` now returns `FALSE` (as it does with older versions of R). (#3906) + # shiny 1.7.5 ## Possibly breaking changes diff --git a/R/utils.R b/R/utils.R index b54484bdeb..d74578cbac 100644 --- a/R/utils.R +++ b/R/utils.R @@ -1240,14 +1240,12 @@ dotloop <- function(fun_, ...) { #' @param x An expression whose truthiness value we want to determine #' @export isTruthy <- function(x) { + if (is.null(x)) + return(FALSE) if (inherits(x, 'try-error')) return(FALSE) - if (!is.atomic(x)) return(TRUE) - - if (is.null(x)) - return(FALSE) if (length(x) == 0) return(FALSE) if (all(is.na(x))) diff --git a/tests/testthat/test-tabPanel.R b/tests/testthat/test-tabPanel.R index f2a91eb6d8..03149c7cee 100644 --- a/tests/testthat/test-tabPanel.R +++ b/tests/testthat/test-tabPanel.R @@ -18,6 +18,9 @@ expect_snapshot2 <- function(...) { if (getRversion() < "3.6.0") { skip("Skipping snapshots on R < 3.6 because of different RNG method") } + if (packageVersion("htmltools") <= "0.5.6" && getRversion() > "4.3.1") { + skip("Skipping snapshots since htmltools is 'outdated'") + } expect_snapshot(...) }