(I have testthat v3.3.2 installed)
It seems that it's not possible to test for "promise" type of an object using expect_type(). I've dug down and the issue lies in quasi_label(), then labelled_value(), and finally in this line calling list(val = value, lab = label), where value is a promise that gets therefore evaluated. I have no idea how to fix it at the moment.
A reprex:
x <- environment()
delayedAssign("q", {
message("Promise evaluated")
1
}, assign.env = x)
testthat::expect_type(x[["q"]], "promise")
#> Promise evaluated
#> Error:
#> ! Expected `x[["q"]]` to have type "promise".
#> Actual type: "double"
Created on 2026-04-08 with reprex v2.1.1
(I have testthat v3.3.2 installed)
It seems that it's not possible to test for "promise" type of an object using
expect_type(). I've dug down and the issue lies inquasi_label(), thenlabelled_value(), and finally in this line callinglist(val = value, lab = label), wherevalueis a promise that gets therefore evaluated. I have no idea how to fix it at the moment.A reprex:
Created on 2026-04-08 with reprex v2.1.1