Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stibu81 opened this issue Mar 2, 2025 · 0 comments · May be fixed by #2065
Open

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

stibu81 opened this issue Mar 2, 2025 · 0 comments · May be fixed by #2065

Comments

@stibu81
Copy link

stibu81 commented Mar 2, 2025

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

@stibu81 stibu81 linked a pull request Mar 2, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant