Skip to content

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

Closed

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

Activity

  1. added
    bug
    on Jul 16, 2025
  2. added a commit that references this issue on Jul 23, 2025
    d947142
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

    bugexpectation 🙀

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions