From 60358238277a26582e0754c84c7e2f2999ef7363 Mon Sep 17 00:00:00 2001 From: Eliot McIntire Date: Fri, 4 Sep 2026 16:24:24 -0700 Subject: [PATCH] fix(docs): drop testthat from the whereInStack example The last line of the whereInStack example called testthat::expect_error(findB3()) testthat is in Suggests, so under `_R_CHECK_DEPENDS_ONLY_` it is not on the library path and R CMD check fails outright: * checking examples ... ERROR Error in loadNamespace(x) : there is no package called 'testthat' * checking examples with --run-donttest ... ERROR `try()` is a better fit regardless. The point of that line is to show the reader that dynGet("b$a") fails because `b$a` is not an object name, and try() prints the error where expect_error() swallowed it -- so the example now demonstrates the thing it is describing, to every reader, whether or not they have testthat installed. Verified it still errors identically: Error in dynGet("b$a") : 'b$a' not found Found by the nosuggests leg of PR #44's matrix, which is the first `_R_CHECK_DEPENDS_ONLY_` check this package has ever had. Its tests now pass there (FAIL 0 | SKIP 12 | PASS 82, the 9 image tests skipped by #46's guard); this was the only remaining failure on that leg, and the last red square in an otherwise green 11-leg matrix. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_011kpoQV6nNqcknk16R3RzBB --- R/plotting.R | 2 +- man/whereInStack.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/plotting.R b/R/plotting.R index f1aaa95..6bdacdc 100644 --- a/R/plotting.R +++ b/R/plotting.R @@ -838,7 +838,7 @@ rePlot <- function(toDev = dev.cur(), fromDev = dev.cur(), clearFirst = TRUE, .. #' b$a <- 2 #' dynGet("b$a") #' } -#' testthat::expect_error(findB3()) # fails because not an object name +#' try(findB3()) # fails because not an object name #' #' findB <- function(x) { #' b$a <- 2 diff --git a/man/whereInStack.Rd b/man/whereInStack.Rd index 685595a..56aea9a 100644 --- a/man/whereInStack.Rd +++ b/man/whereInStack.Rd @@ -71,7 +71,7 @@ findB3 <- function(x) { b$a <- 2 dynGet("b$a") } -testthat::expect_error(findB3()) # fails because not an object name +try(findB3()) # fails because not an object name findB <- function(x) { b$a <- 2