Skip to content

Possible bug in expect_warning() with multiple messages #136

@teunbrand

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

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