R Under development (unstable) (2025-11-10 r88994 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(testthat) > > local({ + if (!requireNamespace("usethis", quietly = TRUE)) { + return() + } + + quietly <- function(expr) { + suppressMessages(capture_output(result <- expr)) + result + } + + perform_test <- function(pkgName, catchEnabled) { + owd <- setwd(tempdir()) + withr::defer(setwd(owd)) + + pkgPath <- file.path(tempdir(), pkgName) + libPath <- file.path(tempdir(), "rlib") + if (!utils::file_test("-d", libPath)) { + dir.create(libPath) + } + .libPaths(c(libPath, .libPaths())) + + withr::defer({ + unlink(pkgPath, recursive = TRUE) + unlink(libPath, recursive = TRUE) + }) + + quietly(usethis::create_package(pkgPath, open = FALSE)) + quietly(testthat::use_catch(pkgPath)) + + cat( + "LinkingTo: testthat", + file = file.path(pkgPath, "DESCRIPTION"), + append = TRUE, + sep = "\n" + ) + + cat( + sprintf("useDynLib(%s, .registration=TRUE)", pkgName), + file = file.path(pkgPath, "NAMESPACE"), + append = TRUE, + sep = "\n" + ) + + if (!catchEnabled) { + isWindows <- Sys.info()[["sysname"]] == "Windows" + makevarsPath <- file.path( + pkgPath, + "src", + if (isWindows) "Makevars.win" else "Makevars" + ) + + cat( + "PKG_CPPFLAGS = -DTESTTHAT_DISABLED", + file = makevarsPath, + sep = "\n" + ) + } + + install.packages(pkgs = pkgPath, repos = NULL, type = "source") + library(pkgName, character.only = TRUE) + stopifnot(.Call("run_testthat_tests", FALSE, PACKAGE = pkgName)) + pkgload::unload(pkgName) + } + + withr::local_envvar(R_TESTS = '') + perform_test("testthatclient1", TRUE) + perform_test("testthatclient2", FALSE) + }) Installing package into 'D:/temp/2025_11_11_15_25_16_14784/RtmpqePCHK/rlib' (as 'lib' is unspecified) * installing *source* package 'testthatclient1' ... ** this is package 'testthatclient1' version '0.0.0.9000' ** using staged installation ** libs using C++ compiler: 'g++.exe (GCC) 14.3.0' make[1]: Entering directory '/d/temp/2025_11_11_15_25_16_14784/RtmpqePCHK/testthatclient1/src' g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -I'D:/temp/2025_11_11_15_25_16_14784/RtmpO6mprP/RLIBS_bf1c4ee58c6/testthat/include' -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -pedantic -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c test-example.cpp -o test-example.o g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -I'D:/temp/2025_11_11_15_25_16_14784/RtmpO6mprP/RLIBS_bf1c4ee58c6/testthat/include' -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -pedantic -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c test-runner.cpp -o test-runner.o g++ -std=gnu++17 -shared -s -static-libgcc -o testthatclient1.dll tmp.def test-example.o test-runner.o -Ld:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64 -Ld:/rtools45/x86_64-w64-mingw32.static.posix/lib -LD:/RCompile/recent/R/bin/x64 -lR make[1]: Leaving directory '/d/temp/2025_11_11_15_25_16_14784/RtmpqePCHK/testthatclient1/src' make[1]: Entering directory '/d/temp/2025_11_11_15_25_16_14784/RtmpqePCHK/testthatclient1/src' make[1]: Leaving directory '/d/temp/2025_11_11_15_25_16_14784/RtmpqePCHK/testthatclient1/src' installing to D:/temp/2025_11_11_15_25_16_14784/RtmpqePCHK/rlib/00LOCK-testthatclient1/00new/testthatclient1/libs/x64 ** R ** byte-compile and prepare package for lazy loading ** help No man pages found in package 'testthatclient1' *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (testthatclient1) =============================================================================== All tests passed (1 assertion in 1 test case) Installing package into 'D:/temp/2025_11_11_15_25_16_14784/RtmpqePCHK/rlib' (as 'lib' is unspecified) * installing *source* package 'testthatclient2' ... ** this is package 'testthatclient2' version '0.0.0.9000' ** using staged installation ** libs using C++ compiler: 'g++.exe (GCC) 14.3.0' make[1]: Entering directory '/d/temp/2025_11_11_15_25_16_14784/RtmpqePCHK/testthatclient2/src' g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -DTESTTHAT_DISABLED -I'D:/temp/2025_11_11_15_25_16_14784/RtmpO6mprP/RLIBS_bf1c4ee58c6/testthat/include' -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -pedantic -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c test-example.cpp -o test-example.o In file included from D:/RCompile/CRANincoming/R-devel/lib/testthat/include/testthat.h:1, from test-example.cpp:12: D:/RCompile/CRANincoming/R-devel/lib/testthat/include/testthat/testthat.h:7:36: warning: 'void testthat_disabled_test_25()' defined but not used [-Wunused-function] 7 | static void TESTTHAT_TOKEN_PASTE(testthat_disabled_test_, __LINE__) () | ^~~~~~~~~~~~~~~~~~~~~~~ D:/RCompile/CRANincoming/R-devel/lib/testthat/include/testthat/testthat.h:4:49: note: in definition of macro 'TESTTHAT_TOKEN_PASTE_IMPL' 4 | #define TESTTHAT_TOKEN_PASTE_IMPL(__X__, __Y__) __X__ ## __Y__ | ^~~~~ D:/RCompile/CRANincoming/R-devel/lib/testthat/include/testthat/testthat.h:7:15: note: in expansion of macro 'TESTTHAT_TOKEN_PASTE' 7 | static void TESTTHAT_TOKEN_PASTE(testthat_disabled_test_, __LINE__) () | ^~~~~~~~~~~~~~~~~~~~ D:/RCompile/CRANincoming/R-devel/lib/testthat/include/testthat/testthat.h:189:41: note: in expansion of macro 'TESTTHAT_DISABLED_FUNCTION' 189 | # define context(__X__) TESTTHAT_DISABLED_FUNCTION | ^~~~~~~~~~~~~~~~~~~~~~~~~~ test-example.cpp:25:1: note: in expansion of macro 'context' 25 | context("Sample unit tests") { | ^~~~~~~ g++ -std=gnu++17 -I"D:/RCompile/recent/R/include" -DNDEBUG -DTESTTHAT_DISABLED -I'D:/temp/2025_11_11_15_25_16_14784/RtmpO6mprP/RLIBS_bf1c4ee58c6/testthat/include' -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include" -pedantic -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c test-runner.cpp -o test-runner.o g++ -std=gnu++17 -shared -s -static-libgcc -o testthatclient2.dll tmp.def test-example.o test-runner.o -Ld:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64 -Ld:/rtools45/x86_64-w64-mingw32.static.posix/lib -LD:/RCompile/recent/R/bin/x64 -lR make[1]: Leaving directory '/d/temp/2025_11_11_15_25_16_14784/RtmpqePCHK/testthatclient2/src' make[1]: Entering directory '/d/temp/2025_11_11_15_25_16_14784/RtmpqePCHK/testthatclient2/src' make[1]: Leaving directory '/d/temp/2025_11_11_15_25_16_14784/RtmpqePCHK/testthatclient2/src' installing to D:/temp/2025_11_11_15_25_16_14784/RtmpqePCHK/rlib/00LOCK-testthatclient2/00new/testthatclient2/libs/x64 ** R ** byte-compile and prepare package for lazy loading ** help No man pages found in package 'testthatclient2' *** installing help indices ** building package indices ** testing if installed package can be loaded from temporary location ** testing if installed package can be loaded from final location ** testing if installed package keeps a record of temporary installation path * DONE (testthatclient2) > > proc.time() user system elapsed 1.17 0.23 19.98