Skip to content

Possible bug in expect_warning() with multiple messages #136

Description

@teunbrand

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

Activity

  1. TimTaylor commented on Jun 13, 2025

    @TimTaylor
    Contributor

    AFAICT - this is already fixed in the master branch (by #114).

  2. teunbrand commented on Jun 13, 2025

    @teunbrand
    Author

    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.

  3. TimTaylor commented on Jun 13, 2025

    @TimTaylor
    Contributor

    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 #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).

  4. teunbrand commented on Jun 13, 2025

    @teunbrand
    Author

    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.

  5. markvanderloo commented on Jun 13, 2025

    @markvanderloo
    Owner

    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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions