* using log directory 'd:/RCompile/CRANincoming/R-devel/testex.Rcheck' * using R version 4.4.0 alpha (2024-04-02 r86304 ucrt) * using platform: x86_64-w64-mingw32 * R was compiled by gcc.exe (GCC) 13.2.0 GNU Fortran (GCC) 13.2.0 * running under: Windows Server 2022 x64 (build 20348) * using session charset: UTF-8 * checking for file 'testex/DESCRIPTION' ... OK * this is package 'testex' version '0.1.0' * package encoding: UTF-8 * checking CRAN incoming feasibility ... NOTE Maintainer: 'Doug Kelkhoff ' New submission * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking serialization versions ... OK * checking whether package 'testex' can be installed ... OK * checking installed package size ... OK * checking package directory ... OK * checking for future file timestamps ... OK * checking 'build' directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking code files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking whether startup messages can be suppressed ... OK * checking use of S3 registration ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking installed files from 'inst/doc' ... OK * checking files in 'vignettes' ... OK * checking examples ... ERROR Running examples in 'testex-Ex.R' failed The error most likely occurred in: > base::assign(".ptime", proc.time(), pos = "CheckExEnv") > ### Name: testex-testthat > ### Title: Support for 'testthat' example expectations > ### Aliases: testex-testthat testthat_block with_srcref > ### fallback_expect_no_error > > ### ** Examples > > ## Don't show: > if (requireNamespace("testthat", quietly = TRUE)) (if (getRversion() >= "3.4") withAutoprint else force)({ # examplesIf + ## End(Don't show) + # example code + 1 + 2 + + # within `testthat_block`, test code refers to previous result with `.` + testthat_block({ + test_that("addition holds up", { + expect_equal(., 3) + }) + + # `with_srcref` to spoof the source of the code that caused the failure + test_that("test failure is spoofed to report error at abc.R:1:0", { + with_srcref("abc.R:1:3", expect_equal(., 3)) + }) + }) + ## Don't show: + }) # examplesIf > 1 + 2 [1] 3 > testthat_block({ + test_that("addition holds up", { + expect_equal(., 3) + }) + test_that("test failure is spoofed to report error at abc.R:1:0", { + with_srcref("abc.R:1:3", expect_equal(., 3)) + }) + }) ── Failure: addition holds up ────────────────────────────────────────────────── `.` not equal to 3. Lengths: 5, 1 names for target but not for current Attributes: < Modes: list, NULL > Attributes: < Lengths: 1, 0 > Attributes: < names for target but not for current > Attributes: < current is not list-like > target is proc_time, current is numeric Error: ! Test failed Backtrace: ▆ 1. ├─(if (getRversion() >= "3.4") withAutoprint else force)(...) 2. │ └─base::source(...) 3. │ ├─base::withVisible(eval(ei, envir)) 4. │ └─base::eval(ei, envir) 5. │ └─base::eval(ei, envir) 6. ├─testex::testthat_block(...) 7. │ └─base::eval(expr, envir = envir) 8. │ └─base::eval(expr, envir = envir) 9. ├─base::local(...) 10. │ └─base::eval.parent(substitute(eval(quote(expr), envir))) 11. │ └─base::eval(expr, p) 12. │ └─base::eval(expr, p) 13. ├─base::eval(...) 14. │ └─base::eval(...) 15. │ └─testex::with_attached(...) 16. │ ├─base::eval(expr) 17. │ │ └─base::eval(expr) 18. │ └─testthat::test_that(...) 19. │ └─withr (local) ``() 20. └─reporter$stop_if_needed() 21. └─rlang::abort("Test failed", call = NULL) Execution halted * checking for unstated dependencies in 'tests' ... OK * checking tests ... OK Running 'spelling.R' Running 'testthat.R' * checking for unstated dependencies in vignettes ... OK * checking package vignettes ... OK * checking re-building of vignette outputs ... OK * checking PDF version of manual ... [21s] OK * checking HTML version of manual ... OK * DONE Status: 1 ERROR, 1 NOTE