tinytest icon indicating copy to clipboard operation
tinytest copied to clipboard

Possible bug in `expect_warning()` with multiple messages

Open teunbrand opened this issue 6 months ago • 5 comments

I expect the following to not throw an error: it is a single warning with 2 messages. It appears there is a vectorisation error here.

fun <- function() {
  cnd <- warningCondition(c("first", "second"))
  warning(cnd)
}
tinytest::expect_warning(fun(), "first")
#> Error in inherits(w, class) && grepl(pattern, w$message, ...): 'length = 2' in coercion to 'logical(1)'

Created on 2025-06-13 with reprex v2.1.1

teunbrand avatar Jun 13 '25 12:06 teunbrand

AFAICT - this is already fixed in the master branch (by https://github.com/markvanderloo/tinytest/pull/114).

TimTaylor avatar Jun 13 '25 12:06 TimTaylor

Right, if this is a duplicate this can just be closed. Is there an expectation when this might propagate to CRAN? The PR you mention is two years old.

teunbrand avatar Jun 13 '25 13:06 teunbrand

Is there an expectation when this might propagate to CRAN? The PR you mention is two years old.

I'm just an interested party. There's an open issue re: 'a new release' at https://github.com/markvanderloo/tinytest/issues/122.

If someone has any spare cycles (metaphorically and literally as there are quite a few revdeps) it may be helpful to run a revdep check on the package and flag the results on that issue (basically minimise the amount of work the maintainer will need to do).

TimTaylor avatar Jun 13 '25 13:06 TimTaylor

Sorry I didn't mean to be rude or grumpy but I'm sorry if I came across that way :) I'm somewhat in a revdep witchhunt myself, which is how I ran across this issue. But as the release is not expected within the next two weeks, I'll just let the dependency know their test might break.

teunbrand avatar Jun 13 '25 13:06 teunbrand

Hey all. I need to release a new version. Problem is that there are many rev deps and some of them need to update first so that takes some coordination from my side. I've been swamped with work and ignored this for a while. I'll try to get it done before summer holiday

markvanderloo avatar Jun 13 '25 18:06 markvanderloo