ソースを参照

Use alternative method to surface errors from callr::r_safe()

tags/v0.3.4
コミット
6c0df7868a
2個のファイルの変更13行の追加3行の削除
  1. +12
    -1
      tests/testthat/helper-session.R
  2. +1
    -2
      tests/testthat/test-themes.R

+ 12
- 1
tests/testthat/helper-session.R ファイルの表示

@@ -3,5 +3,16 @@ with_clean_session <- function(.f, args = list()) {
dir.create(empty_wd)
owd <- setwd(empty_wd)
on.exit({setwd(owd); unlink(empty_wd, TRUE)})
callr::r_safe(.f, args)
args$.f <- .f
res <- callr::r_safe(function(.f, ...) {
tryCatch(
list(result = .f(...), error = NULL),
error = function(e) list(result = NULL, error = e$message)
)
}, args)
if (!is.null(res$error)) {
stop(res$error)
} else {
res$result
}
}

+ 1
- 2
tests/testthat/test-themes.R ファイルの表示

@@ -106,7 +106,6 @@ test_that("style_xaringan() warns about non-hex colors used by theme_xaringan()"
options(warn = 2)
xaringanthemer::style_xaringan(text_color = "rgb(100, 100, 100)", background_color = "white", outfile = NULL)
}),
regexp = "Colors.+used by.+theme_xaringan",
class = "callr_status_error"
regexp = "Colors.+used by.+theme_xaringan"
)
})

読み込み中…
キャンセル
保存