Skip to content

Unquoting first argument does not work for expect_s4_class() #2064

Open
@stibu81

Description

@stibu81

According to the documentation, "the first argument to every expect_ function can use unquoting to construct better labels". But this is not the case for expect_s4_class():

library(testthat)

a <- list(b = 3)
i <- "b"

# unqoting works for expect_s3_class()
expect_s3_class(a[[!!i]], "data.frame")
#> Error: a[["b"]] is not an S3 object

# but not for expect_s4_class()
expect_s4_class(a[[!!i]], "s4_class")
#> Error in !i: invalid argument type

Created on 2025-03-02 with reprex v2.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions