* using log directory ‘/srv/hornik/tmp/CRAN/testex.Rcheck’ * using R Under development (unstable) (2024-04-02 r86304) * using platform: x86_64-pc-linux-gnu * R was compiled by Debian clang version 17.0.6 (5) Debian flang-new version 17.0.6 (5) * running under: Debian GNU/Linux trixie/sid * 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 ... [3s/4s] 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 executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking serialization versions ... OK * checking whether package ‘testex’ can be installed ... [1s/1s] 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 ... [0s/0s] OK * checking whether the package can be loaded with stated dependencies ... [0s/0s] OK * checking whether the package can be unloaded cleanly ... [0s/0s] OK * checking whether the namespace can be loaded with stated dependencies ... [0s/0s] OK * checking whether the namespace can be unloaded cleanly ... [0s/0s] OK * checking loading without being on the library search path ... [0s/0s] OK * checking whether startup messages can be suppressed ... [0s/0s] 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 ... [2s/2s] OK * checking Rd files ... [0s/0s] 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 ... [1s/1s] 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 ... [4s/4s] OK Running ‘spelling.R’ [0s/0s] Running ‘testthat.R’ [3s/3s] * checking for unstated dependencies in vignettes ... OK * checking package vignettes ... OK * checking re-building of vignette outputs ... [2s/2s] OK * checking PDF version of manual ... [3s/3s] OK * checking HTML version of manual ... [0s/0s] OK * checking for non-standard things in the check directory ... OK * checking for detritus in the temp directory ... OK * DONE Status: 1 ERROR, 1 NOTE