Skip to content

Commit

Permalink
Allow exceptions with unknown reason on CRAN's tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asardaes committed Mar 1, 2020
1 parent 8fb324f commit e1c8cab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ LinkingTo:
RcppParallel,
RcppThread
Suggests:
rlang,
testthat
Date: 2020-03-01
Authors@R: c(
Expand Down
15 changes: 15 additions & 0 deletions tests/testthat/setup-expect_error.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
if (!identical(Sys.getenv("NOT_CRAN"), "true")) {
# see https://github.com/RcppCore/Rcpp/issues/972
# what is mentioned there happened on r-devel-fedora-clang
expect_error <- function(...) {
e <- rlang::enexprs(...)

if (is.null(e$regexp)) {
testthat::expect_error(...)
}
else {
e$regexp <- glue::glue("[unknown reason|{ e$regexp }]")
eval(rlang::call2("expect_error", .ns = "testthat", !!!e))
}
}
}

0 comments on commit e1c8cab

Please sign in to comment.