Skip to content

Commit f20c5b5

Browse files
authored
Prepare release (#84)
1 parent 2a033d8 commit f20c5b5

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: mlr3misc
22
Title: Helper Functions for 'mlr3'
3-
Version: 0.11.0-9000
3+
Version: 0.12.0
44
Authors@R: c(
55
person("Michel", "Lang", , "michellang@gmail.com", role = c("cre", "aut"),
66
comment = c(ORCID = "0000-0001-9754-0393")),

NEWS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# mlr3misc 0.12.0
22

3-
* added functions `dictionary_sugar_inc_get` and `dictionary_sugar_inc_mget`
3+
* Added new encapsulation mode `"try"`.
4+
* Added functions `dictionary_sugar_inc_get` and `dictionary_sugar_inc_mget`
45
which allow to conveniently add suffixes to dictionary ids when retrieving
56
objects.
67

R/encapsulate.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#' * `"none"`: Just runs the call in the current session and measures the elapsed time.
88
#' Does not keep a log, output is printed directly to the console.
99
#' Works well together with [traceback()].
10-
#' * `"try-catch"`: Similar to `"none"`, but catches error. Output is printed to the console and
10+
#' * `"try"`: Similar to `"none"`, but catches error. Output is printed to the console and
1111
#' not logged.
1212
#' * `"evaluate"`: Uses the package \CRANpkg{evaluate} to call the function, measure time and do the logging.
1313
#' * `"callr"`: Uses the package \CRANpkg{callr} to call the function, measure time and do the logging.
@@ -56,15 +56,15 @@
5656
encapsulate = function(method, .f, .args = list(), .opts = list(), .pkgs = character(),
5757
.seed = NA_integer_, .timeout = Inf) {
5858

59-
assert_choice(method, c("none", "try-catch", "evaluate", "callr"))
59+
assert_choice(method, c("none", "try", "evaluate", "callr"))
6060
assert_list(.args, names = "unique")
6161
assert_list(.opts, names = "unique")
6262
assert_character(.pkgs, any.missing = FALSE)
6363
assert_count(.seed, na.ok = TRUE)
6464
assert_number(.timeout, lower = 0)
6565
log = NULL
6666

67-
if (method %in% c("none", "try-catch")) {
67+
if (method %in% c("none", "try")) {
6868
require_namespaces(.pkgs)
6969

7070
now = proc.time()[[3L]]

tests/testthat/test_encapsulate.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ test_that("timeout", {
5656
})
5757

5858

59-
test_that("try-catch", {
59+
test_that("try", {
6060
fun1 = function(...) {
6161
message("foo")
6262
}
@@ -65,6 +65,6 @@ test_that("try-catch", {
6565
message("foo")
6666
}
6767

68-
expect_message(encapsulate("try-catch", function(...) message("foo")))
69-
expect_warning(encapsulate("try-catch", function(...) warning("foo")))
68+
expect_message(encapsulate("try", function(...) message("foo")))
69+
expect_warning(encapsulate("try", function(...) warning("foo")))
7070
})

0 commit comments

Comments
 (0)