Skip to content

Commit 2b509ed

Browse files
committed
expand warn catching
1 parent 219b6f5 commit 2b509ed

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tests/testthat/test_refmodel.R

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,15 @@ test_that(paste(
260260

261261
# Without `ynew`:
262262
expect_warning(
263-
predref_resp <- predict(refmods[[tstsetup]], dat, weightsnew = wobs_crr,
264-
offsetnew = offs_crr, type = "response"),
263+
withCallingHandlers(
264+
predref_resp <- predict(refmods[[tstsetup]], dat, weightsnew = wobs_crr,
265+
offsetnew = offs_crr, type = "response"),
266+
warning = function(w) {
267+
if (grepl("(nobars|subbars|findbars|mkReTrms).*reformulas", conditionMessage(w))) {
268+
invokeRestart("muffleWarning")
269+
}
270+
}
271+
),
265272
get_warn_wrhs_orhs(tstsetup, weightsnew = wobs_crr,
266273
offsetnew = offs_crr),
267274
info = tstsetup

0 commit comments

Comments
 (0)