Skip to content

Commit

Permalink
docs: #466 getting pretty; environment tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
bms63 committed Dec 22, 2024
1 parent 9afde36 commit e29b860
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
7 changes: 4 additions & 3 deletions R/lifecycle_admiral.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ deprecate_inform <- function(
with = NULL,
details = NULL,
id = NULL,
env = caller_env(),
user_env = caller_env(2)) {
env = rlang::caller_env(),
user_env = rlang::caller_env(2)) {
tryCatch(
lifecycle::deprecate_soft(
when = when,
Expand All @@ -44,7 +44,8 @@ deprecate_inform <- function(
details = details,
id = id,
env = env,
user_env = user_env),
user_env = user_env
),
warning = \(w) {
message(conditionMessage(w))
tryInvokeRestart("muffleWarning")
Expand Down
4 changes: 2 additions & 2 deletions man/deprecate_inform.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions tests/testthat/_snaps/lifecycle_admiral.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,27 @@
Code
example_fun(data)
Message
`example_fun()` was deprecated in <NA> 1.0.0.
`example_fun()` was deprecated in admiraldev 1.0.0.
i Please use `example_fun2()` instead.
Code
example_fun(data)
Message
`example_fun()` was deprecated in <NA> 1.0.0.
`example_fun()` was deprecated in admiraldev 1.0.0.
i Please use `example_fun2()` instead.

# lifecycle_admiral Test 2: Spicier message is sent to user

Code
example_fun(data)
Message
`example_fun()` was deprecated in <NA> 1.0.0.
`example_fun()` was deprecated in admiraldev 1.0.0.
i Please use `example_fun2()` instead.
x This message will turn into a warning with release of 1.1.0
i See admiral's deprecation guidance: https://pharmaverse.github.io/admiraldev/dev/articles/programming_strategy.html#deprecation
Code
example_fun(data)
Message
`example_fun()` was deprecated in <NA> 1.0.0.
`example_fun()` was deprecated in admiraldev 1.0.0.
i Please use `example_fun2()` instead.
x This message will turn into a warning with release of 1.1.0
i See admiral's deprecation guidance: https://pharmaverse.github.io/admiraldev/dev/articles/programming_strategy.html#deprecation
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-lifecycle_admiral.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ test_that("lifecycle_admiral Test 1: Simple message is sent to user", {
when = "1.0.0",
what = "example_fun()",
with = "example_fun2()"
)
)
assert_data_frame(dataset, required_vars = exprs(STUDYID, USUBJID))
}

Expand Down

0 comments on commit e29b860

Please sign in to comment.