From b2e3727a324967d02356504f3871ffe805d3d4e5 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 24 Dec 2024 16:19:49 -0500 Subject: [PATCH] Fix bug, bump to v1.1.0 --- DESCRIPTION | 2 +- NEWS.md | 3 +++ R/assert.R | 2 +- README.md | 21 +++++++++++---------- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 2174a2f..ce41f1d 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: assert Title: Validate Function Arguments -Version: 1.0.1 +Version: 1.1.0 Authors@R: person(given = "Olivier", family = "Binette", diff --git a/NEWS.md b/NEWS.md index a595681..17c2b5d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,6 @@ +# assert 1.1.0 + - Fix bug with "Run Examples" in help environment. + # assert 1.0.1 - Improved performance. diff --git a/R/assert.R b/R/assert.R index 9b57f27..fb06ceb 100644 --- a/R/assert.R +++ b/R/assert.R @@ -66,7 +66,7 @@ assert <- function(..., else warning(c("\n", msg), call. = FALSE) } else { msg <- c("in ", - eval(quote(match.call()), parent.frame()), + eval(quote(sys.call()), parent.frame()), "\n", msg) if (stop) stop(msg, call. = FALSE) diff --git a/README.md b/README.md index 4d8ebd6..c57b548 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ -# :white_check_mark: assert +# :eyes: assert -[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/assert)](https://cran.r-project.org/package=assert) +[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/assert)](https://cran.r-project.org/package=assert) [![Build Status](https://travis-ci.org/OlivierBinette/assert.svg?branch=master)](https://travis-ci.org/OlivierBinette/assert) ![R-CMD-check](https://github.com/OlivierBinette/assert/workflows/R-CMD-check/badge.svg) @@ -13,7 +13,7 @@ Status](https://travis-ci.org/OlivierBinette/assert.svg?branch=master)](https:// Lightweight validation tool for checking function arguments and data analysis scripts. This is an alternative to stopifnot() from the ‘base’ -package and to assert\_that() from the ‘assertthat’ package. It provides +package and to assert_that() from the ‘assertthat’ package. It provides more informative error messages and facilitates debugging. @@ -78,9 +78,9 @@ rmultinorm <- function(k, mu, sigma) { mu <- c(0,10) sigma <- matrix(c(2,1,1,2), nrow=2) rmultinorm(3, mu, sigma) -#> [,1] [,2] [,3] -#> [1,] -2.246757 -1.424890 -0.9528532 -#> [2,] 7.941552 9.283195 10.4848747 +#> [,1] [,2] [,3] +#> [1,] -0.02311083 -1.060765 1.00757 +#> [2,] 12.94321538 9.129731 14.52424 ``` ``` r @@ -112,15 +112,16 @@ potential errors). `assertthat::assert_that` has the most overhead. ``` r library(assertthat) +#> Warning: package 'assertthat' was built under R version 4.4.2 bench::mark(assert(TRUE), assert_that(TRUE), stopifnot(TRUE), check=FALSE) -#> # A tibble: 3 x 6 +#> # A tibble: 3 × 6 #> expression min median `itr/sec` mem_alloc `gc/sec` #> -#> 1 assert(TRUE) 14.88µs 17.5µs 55463. 0B 55.5 -#> 2 assert_that(TRUE) 29.05µs 32µs 29553. 26.9KB 8.87 -#> 3 stopifnot(TRUE) 2.72µs 3µs 269977. 0B 0 +#> 1 assert(TRUE) 6.5µs 7.2µs 118811. 0B 23.8 +#> 2 assert_that(TRUE) 12.3µs 13.2µs 70165. 26.9KB 21.1 +#> 3 stopifnot(TRUE) 1.2µs 1.3µs 702484. 0B 0 ```