From 7bf7d3d68403f7e6adeb6629f6d30272060ca835 Mon Sep 17 00:00:00 2001 From: Henrik Bengtsson Date: Fri, 18 Oct 2024 23:03:38 -0700 Subject: [PATCH] Add explicit 'filesize' test --- DESCRIPTION | 2 +- man/progressr.Rd | 13 +++++++++++++ tests/handler_filesize.R | 22 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 tests/handler_filesize.R diff --git a/DESCRIPTION b/DESCRIPTION index 9846f94a..44f80ae3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -36,5 +36,5 @@ Suggests: VignetteBuilder: progressr URL: https://progressr.futureverse.org, https://github.com/HenrikBengtsson/progressr BugReports: https://github.com/HenrikBengtsson/progressr/issues -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.2 Roxygen: list(markdown = TRUE) diff --git a/man/progressr.Rd b/man/progressr.Rd index 201a7d0d..48399a6d 100644 --- a/man/progressr.Rd +++ b/man/progressr.Rd @@ -88,6 +88,19 @@ with_progress({ sqrt(x) }) }) +} +\seealso{ +Useful links: +\itemize{ + \item \url{https://progressr.futureverse.org} + \item \url{https://github.com/HenrikBengtsson/progressr} + \item Report bugs at \url{https://github.com/HenrikBengtsson/progressr/issues} +} + +} +\author{ +\strong{Maintainer}: Henrik Bengtsson \email{henrikb@braju.com} (\href{https://orcid.org/0000-0002-7579-5165}{ORCID}) [copyright holder] + } \keyword{iteration} \keyword{programming} diff --git a/tests/handler_filesize.R b/tests/handler_filesize.R new file mode 100644 index 00000000..a2664f4b --- /dev/null +++ b/tests/handler_filesize.R @@ -0,0 +1,22 @@ +source("incl/start.R") + +options(progressr.clear = FALSE) + +options(progressr.handlers = handler_filesize) + +message("handler_filesize() ...") + +for (x in list(integer(0), 1:10, 1L)) { + message("length(x): ", length(x)) + with_progress({ + progress <- progressor(along = x) + for (ii in x) { + Sys.sleep(getOption("progressr.demo.delay", 0.1)) + progress(message = sprintf("(%s)", paste(letters[1:ii], collapse=""))) + } + }) +} + +message("handler_filesize() ... done") + +source("incl/end.R")